diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-11-12 19:10:03 +0100 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-11-12 19:10:03 +0100 |
| commit | 28d26d2bd30acac30d71458405b7cc8dd710a1f1 (patch) | |
| tree | b90b1c8c03bf496bb34fd4e17301a2184412b1c8 | |
| parent | 402888423de9764c22175df4cc41d79157895f3d (diff) | |
rename to memora
| -rw-r--r-- | build.zig | 10 | ||||
| -rw-r--r-- | build.zig.zon | 2 | ||||
| -rw-r--r-- | flake.nix | 4 | ||||
| -rw-r--r-- | src/http.zig | 1 | ||||
| -rw-r--r-- | src/main.zig | 18 |
5 files changed, 16 insertions, 19 deletions
@@ -28,7 +28,7 @@ pub fn build(b: *std.Build) void { // to our consumers. We must give it a name because a Zig package can expose // multiple modules and consumers will need to be able to specify which // module they want to access. - const mod = b.addModule("storyboard", .{ + const mod = b.addModule("memora", .{ // The root source file is the "entry point" of this module. Users of // this module will only be able to access public declarations contained // in this file, which means that if you have declarations that you @@ -58,7 +58,7 @@ pub fn build(b: *std.Build) void { // If neither case applies to you, feel free to delete the declaration you // don't need and to put everything under a single module. const exe = b.addExecutable(.{ - .name = "storyboard", + .name = "memora", .root_module = b.createModule(.{ // b.createModule defines a new module just like b.addModule but, // unlike b.addModule, it does not expose the module to consumers of @@ -73,12 +73,12 @@ pub fn build(b: *std.Build) void { // List of modules available for import in source files part of the // root module. .imports = &.{ - // Here "storyboard" is the name you will use in your source code to - // import this module (e.g. `@import("storyboard")`). The name is + // Here "memora" is the name you will use in your source code to + // import this module (e.g. `@import("memora")`). The name is // repeated because you are allowed to rename your imports, which // can be extremely useful in case of collisions (which can happen // importing modules from different packages). - .{ .name = "storyboard", .module = mod }, + .{ .name = "memora", .module = mod }, }, }), }); diff --git a/build.zig.zon b/build.zig.zon index 67eca1f..352c4f1 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -6,7 +6,7 @@ // // It is redundant to include "zig" in this name because it is already // within the Zig package namespace. - .name = .storyboard, + .name = .memora, // 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", @@ -1,5 +1,5 @@ { - description = "Storyboard"; + description = "Memora"; inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; @@ -13,7 +13,7 @@ devShells.x86_64-linux.default = pkgs.mkShell { packages = [ pkgs.zig - pkgs.psmisc + pkgs.http-server ]; }; }; diff --git a/src/http.zig b/src/http.zig index e8ecfcf..ad4ecb6 100644 --- a/src/http.zig +++ b/src/http.zig @@ -11,7 +11,6 @@ pub fn respond_file( const suffix_pos = std.mem.lastIndexOfScalar(u8, file_name, '.') orelse file_name.len; const suffix = file_name[suffix_pos..]; - std.debug.print("{s}, {}, suffix: {s}\n", .{file_name, suffix_pos, suffix}); try request.respond(buffer, .{ .extra_headers = &.{ diff --git a/src/main.zig b/src/main.zig index b98b112..2566120 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,8 +1,8 @@ const std = @import("std"); -const storyboard = @import("storyboard"); +const memora = @import("memora"); pub const std_options = std.Options { - .logFn = storyboard.log.handler, + .logFn = memora.log.handler, }; const log = std.log.scoped(.main); @@ -32,15 +32,13 @@ pub fn main() !void { var writer = connection.stream.writer(&write_buf); var http_server = std.http.Server.init(reader.interface(), &writer.interface); - while (true) { - var request = http_server.receiveHead() catch break; - log.info("{} {s}", .{request.head.method, request.head.target}); + var request = http_server.receiveHead() catch continue; + log.info("{} {s}", .{request.head.method, request.head.target}); - const handler = storyboard.routes.get(request.head.target); + const handler = memora.routes.get(request.head.target); - handler(&request, allocator) catch |err| { - log.err("handler({s}): {}", .{request.head.target, err}); - }; - } + handler(&request, allocator) catch |err| { + log.err("handler({s}): {}", .{request.head.target, err}); + }; } } |