From 02449e01ffbd4fbc46f5a554c83cd30f1279bc25 Mon Sep 17 00:00:00 2001 From: Rene Schallner Date: Wed, 24 Jan 2024 22:58:19 +0100 Subject: [PATCH] minor simple_router fixes --- README.md | 7 +++++-- examples/simple_router/simple_router.zig | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7e9ba8c..c034473 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/examples/simple_router/simple_router.zig b/examples/simple_router/simple_router.zig index 5c7675d..94838ab 100644 --- a/examples/simple_router/simple_router.zig +++ b/examples/simple_router/simple_router.zig @@ -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, }); }