1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2026-01-29 17:16:56 +00:00
Commit graph

12 commits

Author SHA1 Message Date
renerocksai
a0f67ffc6e
Update to Zig 0.16.0-dev (master) compatibility
Adapt codebase to breaking API changes in Zig 0.16.0-dev:

std.Io introduction:
- std.io namespace renamed to std.Io (capitalization)
- std.http.Client now requires io field
- Create std.Io.Threaded at entry points, pass io to functions
- Use std.Io.Writer.fixed() for fixed buffer writers
- Use std.Io.Dir.cwd().access(io, ...) for file access checks

Sleep API:
- std.Thread.sleep / std.time.sleep removed
- Use std.posix.nanosleep(seconds, nanoseconds) instead

JSON API:
- std.json.stringify() -> std.json.Stringify.value()

Time API:
- std.time.nanoTimestamp() removed
- Use std.time.Instant.now() with .since() for durations

File API:
- readFileAlloc parameter order changed, uses std.Io.Limit

Debug API:
- std.debug.writeStackTrace signature changed (removed debugInfo)
- Capture traces by pointer with |*trace| pattern

Refactored Io pattern in tests/examples to create Threaded once
at entry points and pass io: std.Io to helper functions, following
Zig's new convention of treating Io like allocators.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 16:11:10 +01:00
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
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
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
337276fa52
update basic app example with stop endpoint 2025-03-30 21:16:51 +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
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