Skip to content

Commit

Permalink
minor simple_router fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
renerocksai committed Jan 24, 2024
1 parent b56b64f commit 02449e0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,11 @@ what's necessary to show a feature.
- run it like this: `ZAP_USE_OPENSSL=true zig build run-https`
OR like this: `zig build -Dopenssl=true run-https`
- it will tell you how to generate certificates
- [**Router support**](examples/simple_router/simple_router.zig): You can now use
simple router by path. Also example with self capture helper func.
- [**simple_router**](examples/simple_router/simple_router.zig): See how you
can use `zap.Router` to dispatch to handlers by HTTP path. It also features
`zap.RequestHandler` to capture the "self" pointer of the container of the
handler functions.

I'll continue wrapping more of facil.io's functionality and adding stuff to zap
to a point where I can use it as the JSON REST API backend for real research
projects, serving thousands of concurrent clients.
Expand Down
4 changes: 3 additions & 1 deletion examples/simple_router/simple_router.zig
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ pub fn main() !void {
// start worker threads
zap.start(.{
.threads = 2,
.workers = 2,

// Must be 1 if state is shared
.workers = 1,
});
}

0 comments on commit 02449e0

Please sign in to comment.