From 0395d00b4b0f9e87a4bfab62c73ac047abb2e5da Mon Sep 17 00:00:00 2001 From: rimuspp <19101das@gmail.com> Date: Thu, 8 Feb 2024 19:09:54 -0500 Subject: [PATCH 1/2] Server fix for middleware --- src/jetzig/http/Server.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jetzig/http/Server.zig b/src/jetzig/http/Server.zig index c2c3f25..3d93bd9 100644 --- a/src/jetzig/http/Server.zig +++ b/src/jetzig/http/Server.zig @@ -4,7 +4,7 @@ const jetzig = @import("../../jetzig.zig"); const root_file = @import("root"); const jetzig_server_options = if (@hasDecl(root_file, "jetzig_options")) root_file.jetzig_options else struct {}; -const middlewares: []const type = jetzig_server_options.middleware; +const middlewares: []const type = if (@hasDecl(jetzig_server_options, "middlewares")) jetzig_server_options.middlewares else &.{}; pub const ServerOptions = struct { cache: jetzig.caches.Cache, From ba52d32582de303a0999c26649ddbb4f865072b0 Mon Sep 17 00:00:00 2001 From: rimuspp Date: Fri, 9 Feb 2024 00:30:13 +0000 Subject: [PATCH 2/2] Fixing the template --- src/init/build.zig | 12 +----------- src/init/build.zig.zon | 3 ++- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/init/build.zig b/src/init/build.zig index d64e70f..f60f3e4 100644 --- a/src/init/build.zig +++ b/src/init/build.zig @@ -17,22 +17,12 @@ pub fn build(b: *std.Build) void { const jetzig_dep = b.dependency("jetzig", .{ .optimize = optimize, .target = target }); const compile_view_step = jetzig_build.CompileViewsStep.create(b, .{ .template_path = "src/app/views/" }); - const lib = b.addStaticLibrary(.{ - .name = "%%project_name%%", - // In this case the main source file is merely a path, however, in more - // complicated build scripts, this could be a generated file. - .root_source_file = .{ .path = "src/root.zig" }, - .target = target, - .optimize = optimize, - }); - // This declares intent for the library to be installed into the standard // location when the user invokes the "install" step (the default step when // running `zig build`). - b.installArtifact(lib); const exe = b.addExecutable(.{ - .name = "jetzig-demo", + .name = "%%project_name%%", .root_source_file = .{ .path = "src/main.zig" }, .target = target, .optimize = optimize, diff --git a/src/init/build.zig.zon b/src/init/build.zig.zon index ae51345..a326967 100644 --- a/src/init/build.zig.zon +++ b/src/init/build.zig.zon @@ -3,7 +3,8 @@ .version = "0.0.0", .dependencies = .{ .jetzig = .{ - .url = "https://github.com/jetzig-framework/jetzig/archive/refs/tags/dev.tar.gz", + .url = "https://github.com/jetzig-framework/jetzig/archive/0395d00b4b0f9e87a4bfab62c73ac047abb2e5da.tar.gz", + .hash = "122016141c39005c2149b3c6029b702332c346e3305f52376e1edbc5ee0295318e4c", }, },