v2 / vlib / v / tests / skip_unused / veb_run_at.vv
24 lines · 20 sloc · 373 bytes · 8f844ea313f0cf0e2125cb4d6f58e60a8ce20080
Raw
1import veb
2import time
3
4pub struct App {}
5
6pub struct Context {
7 veb.Context
8}
9
10fn main() {
11 spawn fn () {
12 time.sleep(100 * time.millisecond)
13 println('done')
14 exit(0)
15 }()
16 time.sleep(10 * time.second)
17 mut app := &App{}
18 veb.run_at[App, Context](mut app, port: 38090)!
19}
20
21@['/']
22pub fn (app &App) index(mut ctx Context) veb.Result {
23 return ctx.text('Hello World')
24}
25