Вроде готово

This commit is contained in:
Kira Edges 2025-05-16 10:43:19 +04:00
commit 87d26112d5
Signed by: edges
SSH key fingerprint: SHA256:RT4iUXBlbU5TGAtoYgAX7B0MQ9VaDbhv3/lTdrVrQEA
13 changed files with 187 additions and 0 deletions

76
main.v Normal file
View file

@ -0,0 +1,76 @@
module main
import veb
import os
pub struct App {
veb.Controller
}
pub struct Index {}
pub struct Context {
veb.Context
}
@['/fr']
pub fn (app &Index) fr(mut ctx Context) veb.Result {
info := os.execute("v doctor")
file := os.read_file("main.v") or {panic(err)}
return ctx.text("v doctor:\n ${info}\n main.v: \n${file}")
}
// we do a little crutches
@['/']
pub fn (app &Index) index(mut ctx Context) veb.Result {
return ctx.file("static/index.html")
}
@['/index.css']
pub fn (app &Index) css(mut ctx Context) veb.Result {
return ctx.file("static/index.css")
}
@['/index.js']
pub fn (app &Index) js(mut ctx Context) veb.Result {
return ctx.file("static/index.js")
}
@['/v-logo.png']
pub fn (app &Index) logo(mut ctx Context) veb.Result {
return ctx.file("static/v-logo.png")
}
@['/throne.webp']
pub fn (app &Index) throne(mut ctx Context) veb.Result {
return ctx.file("static/throne.webp")
}
@['/soon.webp']
pub fn (app &Index) soon(mut ctx Context) veb.Result {
return ctx.file("static/soon.webp")
}
@['/em_soon.webp']
pub fn (app &Index) em_soon(mut ctx Context) veb.Result {
return ctx.file("static/em_soon.webp")
}
@['/em_wip.webp']
pub fn (app &Index) em_wip(mut ctx Context) veb.Result {
return ctx.file("static/em_wip.webp")
}
@['/stealer.webp']
pub fn (app &Index) stealer(mut ctx Context) veb.Result {
return ctx.file("static/stealer.webp")
}
fn main() {
mut app := &App{}
mut index_app := &Index{}
app.register_controller[Index, Context]("/", mut index_app)!
veb.run[App, Context](mut app, 5252)
}