From 51307d973255e32ec1440083dee383e8b2cd8878 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Sat, 6 Jun 2026 07:57:50 +0200 Subject: Implement static handler and synchronous server handling --- src/http/handler/static.zig | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/http/handler/static.zig (limited to 'src/http/handler/static.zig') 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 }; +} -- cgit v1.2.3-70-g09d2