Initial project import

This commit is contained in:
Agila Forge Importer committed 2026-07-13 15:20:32 +00:00
commit 23f2d29e32
11957 files changed
+1754577

No files matched your search

@@ -0,0 +1,14 @@
# veb integration example
This example is a compile-time, in-memory `veb.Context` lifecycle sample. It
does not start a `veb` server and does not bind a port.
The example is intentionally small because robust server lifecycle validation
belongs to `veb` itself. Here, `x.async` only coordinates a synthetic handler
step and returns the response body through `Task.wait()`.
Run from the repository root:
```sh
./v run vlib/x/async/examples/veb/app_lifecycle.v
```
@@ -0,0 +1,27 @@
import context
import veb
import x.async as xasync
fn render_health_response() !string {
mut web_ctx := veb.Context{}
_ := web_ctx.text('veb ok')
if web_ctx.res.status_code != 200 {
return error('unexpected veb status')
}
return web_ctx.res.body
}
fn main() {
mut task := xasync.run[string](fn (mut ctx context.Context) !string {
done := ctx.done()
select {
_ := <-done {
return ctx.err()
}
else {}
}
return render_health_response()!
})!
println(task.wait()!)
}