diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-06-06 07:57:50 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-06-06 07:57:50 +0200 |
| commit | 51307d973255e32ec1440083dee383e8b2cd8878 (patch) | |
| tree | dac0309c7abd40d2a3822fca3f7df0fd485e04f0 /src/http/handler/static.zig | |
| parent | 17561c6be1e4fba11e243f2ac842ebe26fae7e60 (diff) | |
Implement static handler and synchronous server handling
Diffstat (limited to 'src/http/handler/static.zig')
| -rw-r--r-- | src/http/handler/static.zig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/http/handler/static.zig b/src/http/handler/static.zig new file mode 100644 index 0000000..d53f213 --- /dev/null +++ b/src/http/handler/static.zig @@ -0,0 +1,13 @@ +const Interface = @import("Interface.zig"); +const Context = @import("context.zig").Context; +const Response = @import("../Response.zig"); + +pub fn Static(route: anytype, content: []const u8) Context(route) { + const get = struct { + fn get(_: Context(route).Request) Response { + return .ok(.string(content)); + } + }.get; + + return .{ .get = get }; +} |