1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-20 15:14:08 +00:00
Commit graph

20 commits

Author SHA1 Message Date
renerocksai
8078b96d3f add on_uncaught_error behavior to zap.App, add on_error callbacks
zap.Endpont.Listener and zap.App now support on_error callbacks:

zap.Endpont.Listener.Settings contains an `on_error` optional callback
field.

zap.App supports those two callbacks:


/// ```zig
/// const MyContext = struct {
///     // You may (optionally) define the following global handlers:
///     pub fn unhandledRequest(_: *MyContext, _: Allocator, _: Request) anyerror!void {}
///     pub fn unhandledError(_: *MyContext, _: Request, _: anyerror) void {}
/// };
/// ```

The `endpoint` example has been updated to showcase `on_error`, and the
new example `app_errors` showcases `Context.unhandledError`.
2025-04-02 09:53:46 +02:00
renerocksai
4c59132a08
added header to example main source files showing how to build & run 2025-03-30 19:40:08 +02:00
renerocksai
fcce4517de
introduced error union to request fn return type 2025-03-16 20:16:14 +01:00
renerocksai
8e80eecc3e
endpoint simplification 2025-03-16 04:45:31 +01:00
Rene Schallner
07c74e757d Refactored request, auth, endpoint:
- zap.Request : refactored into its own file, along with supporting
  types and functions (e.g. http params related)
    - added setContentTypeFromFilename thx @hauleth.
- zap.Auth : zap.Auth.Basic, zap.Auth.BearerSingle, ...
- zap.Endpoint : zap.Endpoint, zap.Endpoint.Authenticating
2024-01-10 15:05:53 +01:00
Rene Schallner
214cfc5dee example comments 2024-01-09 16:01:53 +01:00
renerocksai
3d651229f8 API cleanup #1
--------------

- EndpointListener.register() // was: addEndpoint
- no more Simple
- getEndpoint -> endpoint()
2024-01-08 15:50:46 +01:00
Rene Schallner
82323f835e 0.12.0 ready 2023-12-29 23:34:33 +01:00
Rene Schallner
28b90c7b00 Endpoint example: /stop endpoint & leak detection 2023-07-03 15:54:26 +02:00
Rene Schallner
8067c666b2 on_request fallback for SimpleHttpListener 2023-05-16 03:38:38 +02:00
Rene Schallner
b197fb5ff7 housekeeping 2023-04-21 22:18:22 +02:00
Rene Schallner
dfaadf3140 Enpoint example: from singleton to @fieldParentPtr 2023-04-18 21:02:43 +02:00
Rene Schallner
01df5ce456 more endpoint comments 2023-01-20 20:41:54 +01:00
Rene Schallner
e2e11c8976 fixed endpoint example: jsonification race condition 2023-01-20 20:25:36 +01:00
Rene Schallner
1f8e8ac0e4 saner mem management, thread-safety 2023-01-19 20:34:47 +01:00
Rene Schallner
218b556d30 made endpoint's user list thread-safe 2023-01-18 15:03:21 +01:00
Rene Schallner
720c0f8bfe renamed endpoints example to endpoint 2023-01-18 14:35:52 +01:00
Rene Schallner
80185931c5 cleanup 2023-01-14 16:44:40 +01:00
Rene Schallner
cd18bffc62 endpoints example progress 2023-01-14 16:40:54 +01:00
Rene Schallner
9186bb58ec endpoint example: the beginnings 2023-01-14 16:13:14 +01:00