diff --git a/examples/hello/hello.zig b/examples/hello/hello.zig index 26c2bff..c5fa964 100644 --- a/examples/hello/hello.zig +++ b/examples/hello/hello.zig @@ -1,7 +1,7 @@ const std = @import("std"); const zap = @import("zap"); -fn on_request(r: zap.SimpleRequest) void { +fn on_request_verbose(r: zap.SimpleRequest) void { if (r.path) |the_path| { std.debug.print("PATH: {s}\n", .{the_path}); } @@ -12,11 +12,16 @@ fn on_request(r: zap.SimpleRequest) void { _ = r.sendBody("

Hello from ZAP!!!

"); } +fn on_request_minimal(r: zap.SimpleRequest) void { + _ = r.sendBody("

Hello from ZAP!!!

"); +} + pub fn main() !void { var listener = zap.SimpleHttpListener.init(.{ .port = 3000, - .on_request = on_request, + .on_request = on_request_verbose, .log = false, + .max_clients = 100000, }); try listener.listen(); diff --git a/src/zap.zig b/src/zap.zig index 79282af..186ff21 100644 --- a/src/zap.zig +++ b/src/zap.zig @@ -110,7 +110,7 @@ pub const SimpleHttpListenerSettings = struct { interface: [*c]const u8 = null, on_request: ?SimpleHttpRequestFn, public_folder: ?[]const u8 = null, - max_clients: ?u8 = null, + max_clients: ?isize = null, timeout: ?u8 = null, log: bool = false, };