From 8bf7c8fce080c406818a2721a1ac1185e90f60ce Mon Sep 17 00:00:00 2001 From: myairpods6 Date: Sat, 22 Jun 2024 00:04:05 +0530 Subject: [PATCH] 10 --- src/main.v | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/main.v diff --git a/src/main.v b/src/main.v new file mode 100644 index 0000000..4097b77 --- /dev/null +++ b/src/main.v @@ -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() +}