diff --git a/build.zig b/build.zig index d1eca1b..f7f33bf 100644 --- a/build.zig +++ b/build.zig @@ -16,7 +16,7 @@ pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); const lib = b.addStaticLibrary(.{ - .name = "jungle_zig", + .name = "aoc_zig", // 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 = b.path("src/root.zig"), @@ -30,7 +30,7 @@ pub fn build(b: *std.Build) void { b.installArtifact(lib); const exe = b.addExecutable(.{ - .name = "jungle_zig", + .name = "aoc_zig", .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, diff --git a/build.zig.zon b/build.zig.zon index 87d9ad1..97beeb9 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,5 +1,5 @@ .{ - .name = "jungle_zig", + .name = "aoc_zig", // This is a [Semantic Version](https://semver.org/). // In a future version of Zig it will be used for package deduplication. .version = "0.0.0", diff --git a/src/main.zig b/src/main.zig index 2ac6ea1..236241d 100644 --- a/src/main.zig +++ b/src/main.zig @@ -19,7 +19,7 @@ const Allocator = std.mem.Allocator; // r.sendBody("404 - File not found") catch return; //} -pub const JungleRouter = struct { +pub const WebRouter = struct { const Self = @This(); allocator: Allocator, @@ -83,9 +83,10 @@ pub fn main() !void { .not_found = not_found, }); defer router.deinit(); - var jungle_router = JungleRouter.init(allocator); - try router.handle_func("/", &jungle_router, &JungleRouter.index); - try router.handle_func("/home", &jungle_router, &JungleRouter.home); + var web_router = WebRouter.init(allocator); + try router.handle_func("/home", &web_router, &WebRouter.home); + try router.handle_func("/index", &web_router, &WebRouter.index); + try router.handle_func("/", &web_router, &WebRouter.index); var listener = zap.HttpListener.init(.{ .port = 3000, .on_request = router.on_request_handler(), .log = true, .max_clients = 100000, .public_folder = "src/public" }); try listener.listen(); diff --git a/src/public/index.html b/src/public/index.html index 9d8467a..35aedb2 100644 --- a/src/public/index.html +++ b/src/public/index.html @@ -1,29 +1,52 @@
- - - -