Skip to content

Commit

Permalink
update logger middleware reference (#76)
Browse files Browse the repository at this point in the history
Signed-off-by: Emmanuel Ferdman <[email protected]>
  • Loading branch information
emmanuel-ferdman authored Oct 23, 2024
1 parent dc399be commit 9157de9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ This seems like an unnecessarily expensive thing to do, on each request, when, i
# Middlewares
In general, use a [custom dispatch](#custom-dispatch) function to apply custom logic, such as logging, authentication and authorization. If you have complex route-specific logic, middleware can also be leveraged.

A middleware is a struct which exposes a nested `Config` type, a public `init` function and a public `execute` method. It can optionally define a `deinit` method. See the built-in [CORS middleware](https://github.com/karlseguin/http.zig/blob/master/src/middleware/Cors.zig) or the sample [logger middleware](https://github.com/karlseguin/http.zig/blob/master/example/middleware/Logger.zig) for examples.
A middleware is a struct which exposes a nested `Config` type, a public `init` function and a public `execute` method. It can optionally define a `deinit` method. See the built-in [CORS middleware](https://github.com/karlseguin/http.zig/blob/master/src/middleware/Cors.zig) or the sample [logger middleware](https://github.com/karlseguin/http.zig/blob/master/examples/middleware/Logger.zig) for examples.

A middleware instance is created using `server.middleware()` and can then be used with the router:

Expand Down

0 comments on commit 9157de9

Please sign in to comment.