mirror of
https://github.com/zigzap/zap.git
synced 2025-10-20 23:24:09 +00:00
cleanup
This commit is contained in:
parent
cd18bffc62
commit
80185931c5
5 changed files with 14 additions and 13 deletions
|
@ -23,7 +23,7 @@ pub fn build(b: *std.build.Builder) !void {
|
||||||
.{ .name = "routes", .src = "examples/routes/routes.zig" },
|
.{ .name = "routes", .src = "examples/routes/routes.zig" },
|
||||||
.{ .name = "serve", .src = "examples/serve/serve.zig" },
|
.{ .name = "serve", .src = "examples/serve/serve.zig" },
|
||||||
.{ .name = "hello_json", .src = "examples/hello_json/hello_json.zig" },
|
.{ .name = "hello_json", .src = "examples/hello_json/hello_json.zig" },
|
||||||
.{ .name = "endpoint", .src = "examples/endpoint/main.zig" },
|
.{ .name = "endpoints", .src = "examples/endpoints/main.zig" },
|
||||||
}) |excfg| {
|
}) |excfg| {
|
||||||
const ex_name = excfg.name;
|
const ex_name = excfg.name;
|
||||||
const ex_src = excfg.src;
|
const ex_src = excfg.src;
|
||||||
|
|
|
@ -11,6 +11,7 @@ pub fn main() !void {
|
||||||
.port = 3000,
|
.port = 3000,
|
||||||
.on_request = null,
|
.on_request = null,
|
||||||
.log = true,
|
.log = true,
|
||||||
|
.public_folder = "./examples/endpoints/html",
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
24
src/zap.zig
24
src/zap.zig
|
@ -98,18 +98,18 @@ pub const SimpleRequest = struct {
|
||||||
// C.fiobj_free(new_fiobj_str);
|
// C.fiobj_free(new_fiobj_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn nextParam(self: *const Self) ?HttpParam {
|
// pub fn nextParam(self: *const Self) ?HttpParam {
|
||||||
if (self.h.*.params == 0) return null;
|
// if (self.h.*.params == 0) return null;
|
||||||
var key: C.FIOBJ = undefined;
|
// var key: C.FIOBJ = undefined;
|
||||||
const value = C.fiobj_hash_pop(self.h.*.params, &key);
|
// const value = C.fiobj_hash_pop(self.h.*.params, &key);
|
||||||
if (value == C.FIOBJ_INVALID) {
|
// if (value == C.FIOBJ_INVALID) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
return HttpParam{
|
// return HttpParam{
|
||||||
.key = fio2str(key).?,
|
// .key = fio2str(key).?,
|
||||||
.value = fio2str(value).?,
|
// .value = fio2str(value).?,
|
||||||
};
|
// };
|
||||||
}
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const HttpRequestFn = *const fn (r: [*c]C.http_s) callconv(.C) void;
|
pub const HttpRequestFn = *const fn (r: [*c]C.http_s) callconv(.C) void;
|
||||||
|
|
Loading…
Add table
Reference in a new issue