Skip to content

Commit

Permalink
update: bump zig-router and uncomment some Zig examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sea-grass committed Feb 20, 2024
1 parent 64d789a commit 08d599b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions examples/zig-examples/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ const examples = &[_]Example{
.root_source_file = .{ .path = "src/params.zig" },
.path = "params/[id]",
},
//.{
// .name = "router",
// .root_source_file = .{ .path = "src/router.zig" },
// .path = "router/[...path]",
//},
.{
.name = "router",
.root_source_file = .{ .path = "src/router.zig" },
.path = "router/[...path]",
},
};

const Example = struct {
Expand All @@ -64,7 +64,7 @@ pub fn build(b: *std.Build) !void {
const optimize = b.standardOptimizeOption(.{});

const wws_dep = b.dependency("wws", .{});
//const zig_router_dep = b.dependency("zig-router", .{});
const zig_router_dep = b.dependency("zig-router", .{});

const wf = b.addWriteFiles();

Expand All @@ -79,7 +79,7 @@ pub fn build(b: *std.Build) !void {
.features = e.features orelse .{},
});

//worker.exe.root_module.addImport("zig-router", zig_router_dep.module("zig-router"));
worker.exe.root_module.addImport("zig-router", zig_router_dep.module("zig-router"));

try worker.addToWriteFiles(b, wf);
}
Expand Down
8 changes: 4 additions & 4 deletions examples/zig-examples/build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
.wws = .{
.path = "../../kits/zig/wws",
},
//.@"zig-router" = .{
// .url = "https://github.com/Cloudef/zig-router/archive/dc438755c5a6d5fec2efb9e413e8c03a3f637585.tar.gz",
// .hash = "1220a53ebca3e6d9958341c83767ef9763f947ef68e60362764d12a972227a1339bc",
//},
.@"zig-router" = .{
.url = "https://github.com/Cloudef/zig-router/archive/e8df16c9281969aef3cbb3c788f2c8c2b4f9ec30.tar.gz",
.hash = "1220fabbdaa72ff4801b62cc577e2e63849e960fbc22b67d560080726c53fb7c28cc",
},
},

// Specifies the set of files and directories that are included in this package.
Expand Down
4 changes: 2 additions & 2 deletions examples/zig-examples/src/router.zig
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ fn handle(arena: std.mem.Allocator, request: wws.Request) !wws.Response {
const router = zig_router.Router(
.{},
.{
zig_router.Route(.GET, "/router/hello", getHello),
zig_router.Route(.GET, "/router/post/:id", getBlogPost),
zig_router.Route(.GET, "/router/hello", getHello, .{}),
zig_router.Route(.GET, "/router/post/:id", getBlogPost, .{}),
},
);

Expand Down

0 comments on commit 08d599b

Please sign in to comment.