Repository navigation
Home
Neon32eeee edited this page Oct 17, 2026
·
1 revision
Mesh is a small set of helpers built on top of zap for writing HTTP servers in Zig. It doesn't try to be a framework - it just removes the boilerplate that would otherwise repeat in every handler: sending status codes, parsing request bodies, checking HTTP methods, and swapping a real database for a stub.
The structure mirrors the request lifecycle. Three entities matter:
-
Request - comes from
zap, carries method, path, params, and body. - Handler - your function; Mesh provides the helpers it calls.
-
Response - sent via
Mesh.responsehelpers, either a body or an error.
Around that, Mesh adds one more piece: a DB wrapper that lets the same handler run against a real database or a no-op stub.
- Response helpers - send status codes and bodies without ceremony.
-
Method helpers - check
GET/POST/ etc. and reject wrong methods automatically. - JSON helpers - parse request bodies into Zig structs and serialize responses back.
-
DB wrapper - one call site for
save(), works with or without a real database. - VoidDB - the stub itself, used in tests and persistence-free builds.