jetzig-framework / jetzig

Jetzig is a web framework written in Zig
MIT License
308 stars 15 forks source link

Implement custom routes #73

Closed bobf closed 1 month ago

bobf commented 1 month ago

In main():

    app.route(.GET, "/custom/:id/foo/bar", @import("app/views/custom/foo.zig"), .bar);

Routes GET request with path (e.g.) /custom/1234/foo/bar to bar() defined in src/app/views/custom/foo.zig.

Routes with an :id segment expect a function with three parameters, routes without an :id segment expect a function with two parameters (i.e. the same as get vs index).