diff options
Diffstat (limited to 'src/http/RouteSet.zig')
| -rw-r--r-- | src/http/RouteSet.zig | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/http/RouteSet.zig b/src/http/RouteSet.zig new file mode 100644 index 0000000..3b6bfa7 --- /dev/null +++ b/src/http/RouteSet.zig @@ -0,0 +1,49 @@ +const std = @import("std"); + +const Route = @import("Route.zig"); +const handler = @import("handler.zig"); +const Interface = handler.Interface; +const Context = handler.Context; + +literals: []struct { + value: []const u8, + node: *@This(), +}, +identifiers: []@This(), +interface: ?Interface, + +pub fn init(comptime interfaces: []const Interface) @This() { + _ = interfaces; + return undefined; +} + +pub fn getInterface(self: *const @This(), url: []const u8) ?Interface { + _ = self; + _ = url; + return null; +} + +test "init" { + const M = struct { + const Response = @import("Response.zig"); + + const C = Context(.{ "api", "images", .id, "metadata" }); + const context: C = .{}; + + const Query = struct { + condition: []const u8, + start: usize, + length: usize, + }; + + pub fn get(request: C.Request) Response { + _ = request; + return .ok(.static("hello")); + } + }; + + const routes = init(&.{M.context.interface()}); + + const interface = routes.getInterface("/api/images/123456/metadata"); + _ = interface; +} |