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

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!");
}