- Express-like routing โ
hawk.app.get,.post,.del, and friends - Type-safe DSL โ
let,when...of,??,|>, and compile-time type annotations - Typed collections โ
List<T>,Dict<K, V>,Record(JSON-aware) - URL helpers โ
libs/urlZig-backed URL encode/decode with AWK fallback - JSON helpers โ
libs/jsonZig-backed JSON encode/decode; typedctx.res.json(List<Todo>) - Gzip compression โ
libs/gzipHTTP response compression;HAWK_GZIP=1to enable - XSS-safe by design โ brand types make unsafe HTML a desugar-time error
- Multi-worker โ
SO_REUSEPORT+ HTTP/1.1 keep-alive via optional Zig extensions
Requirements: gawk 5.0+, bash 4.3+, GNU make
cp .env.example .env
./bin/hawk app.awk # Start on :8080 (multi-worker requires libs/net)curl http://localhost:8080/
curl -X POST -d 'title=buy+milk' http://localhost:8080/todos
curl -X DELETE http://localhost:8080/todos/1234BEGIN { hawk.app.get("/todos", "list_todos") hawk.app.post("/todos", "add_todo") hawk.app.listen(8080) } function list_todos() { let rows = [] let n: Int = read_tsv("data/todos.tsv", rows) let payload = [] payload["count"] = n return ctx.res.json(payload) } function add_todo() { when ctx.req.form("title") of ok raw: ctx.res.status(201) return ctx.res.html(safe.html.fragment( "<li>", safe.html.escape(raw), "</li>" )) ng: ctx.res.status(400) return ctx.res.text("title required") end }
| Setup & Installation | Requirements, build-libs, fetch-libs |
| CLI Reference | Subcommands and flags |
| Routing | Route registration, router files |
| DSL Reference | let, when...of, ??, ` |
| API Reference | Context API, request/response, env:: |
| Plugins | Plugin hooks, submodule distribution |
| Native Extensions | Zig libs, cache API, multi-worker |
| Testing | Test targets and CI |
MIT ยฉ redpeacock78 ยท ๐ ๆฅๆฌ่ช