diff --git a/examples/hello2/hello2.zig b/examples/hello2/hello2.zig new file mode 100644 index 0000000..b4e674f --- /dev/null +++ b/examples/hello2/hello2.zig @@ -0,0 +1,45 @@ +const std = @import("std"); +const zap = @import("zap"); + +fn on_request(r: zap.SimpleRequest) void { + const m = r.method orelse ""; + const p = r.path orelse "/"; + const qm = if (r.query) |_| "?" else ""; + const qq = r.query orelse ""; + + std.debug.print(">> {s} {s}{s}{s}\n", .{ m, p, qm, qq }); + + if (r.body) |the_body| { + std.debug.print(">> BODY: {s}\n", .{the_body}); + } + + _ = r.sendBody( + \\
+ \\