10
This commit is contained in:
parent
43e61478b2
commit
8bf7c8fce0
1 changed files with 30 additions and 0 deletions
30
src/main.v
Normal file
30
src/main.v
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
module main
|
||||||
|
|
||||||
|
import vweb
|
||||||
|
import os
|
||||||
|
|
||||||
|
const (
|
||||||
|
port = 8082
|
||||||
|
)
|
||||||
|
|
||||||
|
struct App {
|
||||||
|
vweb.Context
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn (app App) before_request() {
|
||||||
|
println('[web] before_request: ${app.req.method} ${app.req.url}')
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
mut app := &App{}
|
||||||
|
app.serve_static('/favicon.ico', 'src/assets/favicon.ico')
|
||||||
|
// makes all static files available.
|
||||||
|
app.mount_static_folder_at(os.resource_abs_path('.'), '/')
|
||||||
|
|
||||||
|
vweb.run(app, port)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn (mut app App) login() vweb.Result {
|
||||||
|
|
||||||
|
return $vweb.html()
|
||||||
|
}
|
Loading…
Reference in a new issue