add apple_pie hello world

This commit is contained in:
Luna 2021-04-09 18:11:44 -03:00
parent 368675acd7
commit 866fee1502
3 changed files with 19 additions and 0 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
zig-cache/
deps.zig
.zigmod/

View file

@ -1,5 +1,19 @@
const std = @import("std");
const http = @import("apple_pie");
pub fn main() anyerror!void {
std.log.info("All your codebase are belong to us.", .{});
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
try http.listenAndServe(
&gpa.allocator,
try std.net.Address.parseIp("127.0.0.1", 8080),
index,
);
}
fn index(response: *http.Response, request: http.Request) !void {
try response.writer().writeAll("Hello Zig!");
}

View file

@ -2,3 +2,7 @@ id: n5imv64i14btgrqm6qbzyhqs2xc2e7w3hxk1l9b9s5qmtfz0
name: yet-another-pomf-clone
main: src/main.zig
dependencies:
- src: git https://github.com/Luukdegram/apple_pie
name: apple_pie
main: src/apple_pie.zig