Skip to content

Commit

Permalink
registerDispatcher function added to router (#79)
Browse files Browse the repository at this point in the history
* registerDispatcher function added to router

* more general solution as per Karl's comment

---------

Co-authored-by: Steve🔆 <[email protected]>
  • Loading branch information
zigster64 and Steve🔆 authored Nov 23, 2024
1 parent 3661935 commit 656dfca
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/router.zig
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ pub fn Router(comptime Handler: type, comptime Action: type) type {
};
}

/// routeConfig allows the user to pass an anon struct, and have it coerced into the correct RC type for this router
pub fn routeConfig(_: Self, config: RC) RC {
return config;
}

pub fn get(self: *Self, path: []const u8, action: Action, config: RC) void {
self.tryGet(path, action, config) catch @panic("failed to create route");
}
Expand Down

0 comments on commit 656dfca

Please sign in to comment.