| 1 | import context |
| 2 | import veb |
| 3 | import x.async as xasync |
| 4 | |
| 5 | fn render_health_response() !string { |
| 6 | mut web_ctx := veb.Context{} |
| 7 | _ := web_ctx.text('veb ok') |
| 8 | if web_ctx.res.status_code != 200 { |
| 9 | return error('unexpected veb status') |
| 10 | } |
| 11 | return web_ctx.res.body |
| 12 | } |
| 13 | |
| 14 | fn main() { |
| 15 | mut task := xasync.run[string](fn (mut ctx context.Context) !string { |
| 16 | done := ctx.done() |
| 17 | select { |
| 18 | _ := <-done { |
| 19 | return ctx.err() |
| 20 | } |
| 21 | else {} |
| 22 | } |
| 23 | return render_health_response()! |
| 24 | })! |
| 25 | |
| 26 | println(task.wait()!) |
| 27 | } |
| 28 | |