v2 / examples / veb / static_website / server.v
21 lines · 17 sloc · 388 bytes · c004d0c8997e8d952c2110c26143d94baa346d70
Raw
1module main
2
3import veb
4import os
5
6pub struct Context {
7 veb.Context
8}
9
10pub struct App {
11 veb.StaticHandler
12}
13
14fn main() {
15 // make sure that the working folder is the one, containing the executable,
16 // so that 'dist' is a valid relative path from it later:
17 os.chdir(os.dir(os.executable()))!
18 mut app := &App{}
19 app.handle_static('dist', true)!
20 veb.run[App, Context](mut app, 8080)
21}
22