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

181 commits

Author SHA1 Message Date
renerocksai
5740b3b1a1
fix app_basic 0.15.1 2025-08-28 20:24:35 +02:00
renerocksai
dabd0637f9
endpoints, auth endpoints, middleware endpoints: eliminate need for empty stubs 2025-07-23 20:23:49 +02:00
renerocksai
6bdd5a41e4
exapmles/app/errors.zig: remove unnecessary empty stubs 2025-07-23 19:00:06 +02:00
Rene Schallner
29d339892e
Merge pull request #171 from Tesseract22/master
Provide defaults to unimplemented methods in endpoints for App style api.
2025-07-23 00:51:38 +02:00
Tesseract22
c0cc025eda Provide defaults to unprovided restful method handler
Make `get`, `post`, ... methods optional. Check whether these method
exist at comptime. When no corresponding method is provided,
the handler simply return immediately.

Since it uses comptime, hopefully it should not add any checks at
runtime.
2025-07-13 15:02:35 +08:00
QSmally
fd567f3c29
Zap: remove newline for Zig's default log fn 2025-05-08 15:30:54 +02:00
Mimi
b134f969f3 fix: add missing head handler for EndpointType 2025-04-21 18:36:46 -03:00
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
8d187310c7 harmonize callback function error handling, zap logging; doc updates 2025-04-01 16:30:24 +02:00
renerocksai
337276fa52
update basic app example with stop endpoint 2025-03-30 21:16:51 +02:00
renerocksai
a01c6146ec
Minor README & comment cosmetics 2025-03-30 20:32:33 +02:00
renerocksai
3a2246ba50
cleanup unused params where applicable (ie non-instructive) 2025-03-30 19:58:22 +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
cc6d55fbf7
Improved & generalized checkEndpoint functions
E.g. return type's error set does not need to be `anyerror` anymore.
2025-03-30 19:37:40 +02:00
renerocksai
307cc2f13e
remove legacy, update README 2025-03-30 14:46:08 +02:00
renerocksai
b8ca82f0fd zap.App.Create(Context).Endpoint.Authenticating -> zap.App is READY. 2025-03-30 13:17:32 +02:00
renerocksai
458d6ee071 First zap.App test SUCCESS!!! 2025-03-30 11:28:36 +02:00
Rene Schallner
f4e42f2557 add zap.Request.headersToOwnedList() 2025-03-21 19:31:11 +01:00
Rene Schallner
3aaa7fcc24 removed Self and @This() as much as possible 2025-03-21 18:57:33 +01:00
Rene Schallner
9eb254d5f8 get rid of zap.util.FreeOrNot 2025-03-21 18:21:27 +01:00
renerocksai
fcce4517de
introduced error union to request fn return type 2025-03-16 20:16:14 +01:00
renerocksai
a63e47ea3d
print username, pass in userpass_session example 2025-03-16 16:18:03 +01:00
renerocksai
ab42f971a0
remove usingnamespace 2025-03-16 16:17:42 +01:00
renerocksai
7f82a6b350
fixed zap.Middleware + example for endpoint handlers to new zap.Endpoint 2025-03-16 14:13:54 +01:00
renerocksai
d0cb7520ac
fix endpoint_auth example for new Endpoint stuff 2025-03-16 13:39:23 +01:00
renerocksai
8e80eecc3e
endpoint simplification 2025-03-16 04:45:31 +01:00
Rene Schallner
2d3f8938a5 fix https example output's suggested curl command 2025-02-25 12:56:02 +00:00
Thom Dickson
903716bcf5
update docs and examples for endpoint middleware 2024-07-25 20:38:26 -04:00
Rene Schallner
c79d62ca2c proposed change to parseAccept API 2024-04-27 21:29:32 +02:00
Louis Pearson
4988feb314 fix: simplify accept header api somewhat 2024-04-24 21:53:41 -06:00
Rene Schallner
9674c8f87a
Update hello_json.zig 2024-04-24 02:11:28 +02:00
Rene Schallner
1e1999802a Merge branch 'zig-0.12.0' 2024-04-21 14:20:15 +02:00
Rene Schallner
8cfd190fb2
Merge branch 'zig-0.12.0' into zig-0.12.0 2024-04-21 13:59:47 +02:00
Rene Schallner
740ddab2a1
Merge branch 'zig-0.12.0' into zig-0.12.0 2024-04-21 13:54:51 +02:00
geemili
5f4b7957dc fix: use error return trace in senderror
This should produce more usable error messages. The error messages before
this were pointing at zap runtime functions, instead of at the code that
produced the error.
2024-04-18 16:16:15 -06:00
Andreas Stocker
44af23827e fix breaking changes as of 14-4-24 2024-04-14 18:19:18 +02:00
Tobias Simetsreiter
3f7492260d zig 0.12.0-dev.3561+f45ba7d0c: remove type argument from fieldParentPtr 2024-04-07 18:21:49 +02:00
dweiller
43b6993942 update for @fieldParentPointer RLS change 2024-04-05 15:13:44 +11:00
Rene Schallner
c81a211bd3 re-write of zap.Router, fix #83 2024-03-23 23:00:25 +01:00
Rene Schallner
b2f4e29258 re-write of zap.Router, fix #83 2024-03-23 22:35:49 +01:00
Rene Schallner
8cf48ddfc1 zig master: exit, get_env fixes 2024-03-23 22:23:13 +01:00
Rene Schallner
77f5fd05b9 use methodAsEnum() in endpoint and json example 2024-02-24 15:57:11 +01:00
Rene Schallner
6d710ba448 use methodAsEnum() in endpoint and json example 2024-02-24 15:52:27 +01:00
Rene Schallner
5ea15b8a3e performance: revert r.method enum back to ?[]const u8 new http.Method enum is available via r.methodAsEnum() 2024-02-24 15:49:14 +01:00
Rene Schallner
8a18a0258f performance: revert r.method enum back to ?[]const u8
new http.Method enum is available via r.methodAsEnum()
2024-02-24 15:36:44 +01:00
Joe Liotta
4393866ea5 fixed unneeded optional unwrap in hello_json 2024-02-23 20:21:24 +01:00
Rene Schallner
1f6e945c08 cosmetics 2024-02-23 20:21:11 +01:00
Rene Schallner
680e981d13 access raw query params w/o allocator, close #40 2024-02-23 20:20:58 +01:00
Froxcey
694b3196db Use custom method enum 2024-02-23 20:20:00 +01:00
Froxcey
39ee26f9a4 Use std.http.Method for Request.method 2024-02-23 20:16:44 +01:00