mirror of
https://github.com/zigzap/zap.git
synced 2025-10-20 15:14:08 +00:00
improvements
This commit is contained in:
parent
e50072ebe3
commit
eaf501df30
2 changed files with 43 additions and 17 deletions
32
build.zig
32
build.zig
|
@ -14,10 +14,35 @@ pub fn build(b: *std.build.Builder) !void {
|
|||
var ensure_step = b.step("deps", "ensure external dependencies");
|
||||
ensure_step.makeFn = ensureDeps;
|
||||
|
||||
const example_run_step = b.step("run-example", "run the example");
|
||||
const example_step = b.step("example", "build the example");
|
||||
inline for ([_]struct {
|
||||
name: []const u8,
|
||||
src: []const u8,
|
||||
}{
|
||||
.{ .name = "hello", .src = "examples/hello/hello.zig" },
|
||||
// .{ .name = "routes", .src = "examples/routes/routes.zig" },
|
||||
// .{ .name = "serve", .src = "examples/serve/serve.zig" },
|
||||
}) |excfg| {
|
||||
const ex_name = excfg.name;
|
||||
const ex_src = excfg.src;
|
||||
const ex_build_desc = try std.fmt.allocPrint(
|
||||
b.allocator,
|
||||
"build the {s} example",
|
||||
.{ex_name},
|
||||
);
|
||||
const ex_run_stepname = try std.fmt.allocPrint(
|
||||
b.allocator,
|
||||
"run-{s}",
|
||||
.{ex_name},
|
||||
);
|
||||
const ex_run_stepdesc = try std.fmt.allocPrint(
|
||||
b.allocator,
|
||||
"run the {s} example",
|
||||
.{ex_name},
|
||||
);
|
||||
const example_run_step = b.step(ex_run_stepname, ex_run_stepdesc);
|
||||
const example_step = b.step(ex_name, ex_build_desc);
|
||||
|
||||
var example = b.addExecutable("example", "examples/hello/hello.zig");
|
||||
var example = b.addExecutable(ex_name, ex_src);
|
||||
example.setBuildMode(mode);
|
||||
example.addPackage(zap);
|
||||
example.addIncludePath("src/deps/facilio/libdump/all");
|
||||
|
@ -34,6 +59,7 @@ pub fn build(b: *std.build.Builder) !void {
|
|||
example.step.dependOn(ensure_step);
|
||||
example_step.dependOn(&example_build_step.step);
|
||||
}
|
||||
}
|
||||
|
||||
fn logstep(msg: []const u8) void {
|
||||
std.debug.print("=================================================\n", .{});
|
||||
|
|
|
@ -13,7 +13,7 @@ fn on_request(r: zap.SimpleRequest) void {
|
|||
}
|
||||
|
||||
pub fn main() !void {
|
||||
var listener: zap.SimpleHttpListener = zap.SimpleHttpListener.init(.{
|
||||
var listener = zap.SimpleHttpListener.init(.{
|
||||
.port = 3000,
|
||||
.on_request = on_request,
|
||||
.log = false,
|
||||
|
|
Loading…
Add table
Reference in a new issue