add apple_pie hello world
This commit is contained in:
parent
368675acd7
commit
866fee1502
3 changed files with 19 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -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!");
|
||||
}
|
||||
|
|
4
zig.mod
4
zig.mod
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue