Compare commits
3 commits
Author | SHA1 | Date | |
---|---|---|---|
3826058062 | |||
4649021978 | |||
0e9cdcb6eb |
5 changed files with 10 additions and 5 deletions
|
@ -28,7 +28,7 @@ _Zouter_ is an HTTP router library for Zig **zap** HTTP server. It's made to eas
|
||||||
|
|
||||||
## Versions
|
## Versions
|
||||||
|
|
||||||
Zouter 0.1.0 is made for zig 0.13.0 and tested with zap 0.8.0.
|
Zouter 0.1.1 is made for zig 0.13.0 and tested with zap 0.8.0.
|
||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ Zouter 0.1.0 is made for zig 0.13.0 and tested with zap 0.8.0.
|
||||||
In your project directory:
|
In your project directory:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ zig fetch --save https://code.zeptotech.net/zedd/zouter/archive/v0.1.0.tar.gz
|
$ zig fetch --save https://code.zeptotech.net/zedd/zouter/archive/v0.1.1.tar.gz
|
||||||
```
|
```
|
||||||
|
|
||||||
In `build.zig`:
|
In `build.zig`:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.{
|
.{
|
||||||
.name = "zouter",
|
.name = "zouter",
|
||||||
.version = "0.1.0",
|
.version = "0.1.1",
|
||||||
.minimum_zig_version = "0.13.0",
|
.minimum_zig_version = "0.13.0",
|
||||||
|
|
||||||
.dependencies = .{
|
.dependencies = .{
|
||||||
|
@ -14,5 +14,7 @@
|
||||||
"build.zig",
|
"build.zig",
|
||||||
"build.zig.zon",
|
"build.zig.zon",
|
||||||
"src",
|
"src",
|
||||||
|
"README.md",
|
||||||
|
"LICENSE",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
const std = @import("std");
|
|
||||||
const router = @import("router.zig");
|
const router = @import("router.zig");
|
||||||
const route = @import("route.zig");
|
const route = @import("route.zig");
|
||||||
|
|
||||||
|
|
|
@ -195,6 +195,8 @@ pub const RouteNode = struct {
|
||||||
.handle = definition.handle,
|
.handle = definition.handle,
|
||||||
.handleNotFound = definition.handleNotFound,
|
.handleNotFound = definition.handleNotFound,
|
||||||
.handleError = definition.handleError,
|
.handleError = definition.handleError,
|
||||||
|
.preHandle = definition.preHandle,
|
||||||
|
.postHandle = definition.postHandle,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -203,6 +205,8 @@ pub const RouteNode = struct {
|
||||||
childTree.handle = definition.handle;
|
childTree.handle = definition.handle;
|
||||||
childTree.handleNotFound = definition.handleNotFound;
|
childTree.handleNotFound = definition.handleNotFound;
|
||||||
childTree.handleError = definition.handleError;
|
childTree.handleError = definition.handleError;
|
||||||
|
childTree.preHandle = definition.preHandle;
|
||||||
|
childTree.postHandle = definition.postHandle;
|
||||||
|
|
||||||
if (definition.children) |children|
|
if (definition.children) |children|
|
||||||
{ // If there are children, recursively parse them.
|
{ // If there are children, recursively parse them.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const zouter = @import("../src/root.zig");
|
const zouter = @import("zouter");
|
||||||
|
|
||||||
test {
|
test {
|
||||||
// try std.testing.refAllDecls(zouter);
|
// try std.testing.refAllDecls(zouter);
|
||||||
|
|
Loading…
Reference in a new issue