aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main.zig b/src/main.zig
index 4b2b025..6d2b9ce 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -8,6 +8,8 @@ const http = @import("http");
const html = @import("html");
const z = @import("z");
+const Static = http.handler.Static;
+
const components = @import("web/component/root.zig").components;
const document: html.Element = .native(.html, .{}, .children(&.{
@@ -26,9 +28,17 @@ const document: html.Element = .native(.html, .{}, .children(&.{
})),
}));
+const routes: http.RouteSet = .init(&.{
+ Static(.index, document.toDocument()).interface(),
+});
+
pub fn main(init: std.process.Init) !void {
- var server: http.Server = try .init(init.gpa, try .parseLiteral("0.0.0.0:8080"));
- try server.serve(comptime document.toDocument());
+ var server: http.Server = try .init(
+ init.gpa,
+ try .parseLiteral("0.0.0.0:8080"),
+ routes,
+ );
+ try server.serve(init.gpa);
}
test {