Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frameworks/Zig/zzz/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# [ZZZ](https://github.com/tardy-org/zzz) - Web Franework.
# [ZZZ](https://github.com/tardy-org/zzz) - Web Framework.

## Description

Expand Down
8 changes: 6 additions & 2 deletions frameworks/Zig/zzz/src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,23 @@ pub fn main() !void {
}

pub fn home_handler(ctx: *const Context, _: void) !Respond {
try ctx.response.headers.put("Date", try ctx.allocator.dupe(u8, date[0..]));
return ctx.response.apply(.{
.mime = http.Mime.TEXT,
.body = "Hello, World!",
.status = .OK,
.headers = &.{
.{"Date", try ctx.allocator.dupe(u8, date[0..])},
},
});
}

pub fn json_handler(ctx: *const Context, _: void) !Respond {
try ctx.response.headers.put("Date", try ctx.allocator.dupe(u8, date[0..]));
return ctx.response.apply(.{
.mime = http.Mime.JSON,
.body = try std.json.stringifyAlloc(ctx.allocator, Message{ .message = "Hello, World!" }, .{}),
.status = .OK,
.headers = &.{
.{"Date", try ctx.allocator.dupe(u8, date[0..])},
},
});
}
Loading