add apple_pie hello world
This commit is contained in:
parent
368675acd7
commit
866fee1502
|
@ -1,2 +1,3 @@
|
|||
zig-cache/
|
||||
deps.zig
|
||||
.zigmod/
|
||||
|
|
14
src/main.zig
14
src/main.zig
|
@ -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!");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue