diff options
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 36 |
1 files changed, 5 insertions, 31 deletions
diff --git a/src/main.zig b/src/main.zig index 6d2b9ce..bf1b09f 100644 --- a/src/main.zig +++ b/src/main.zig @@ -5,42 +5,16 @@ const std = @import("std"); const http = @import("http"); -const html = @import("html"); -const z = @import("z"); +const api = @import("api"); -const Static = http.handler.Static; +const web = @import("web/root.zig"); -const components = @import("web/component/root.zig").components; - -const document: html.Element = .native(.html, .{}, .children(&.{ - .native(.head, .{}, .children(&.{ - .native(.title, .{}, .content("Memora")), - .native(.meta, .{ - .name = "viewport", - .content = "width=device-width, initial-scale=1.0", - }, .void), - z.script.load(@embedFile("web/pinch.js")), - z.style.load(@embedFile("web/index.css")), - z.env(components), - })), - .native(.body, .{}, .children(&.{ - z.html.load(@embedFile("web/index.html")), - })), -})); - -const routes: http.RouteSet = .init(&.{ - Static(.index, document.toDocument()).interface(), -}); +const routes: http.RouteSet = .init(api.interfaces ++ web.interfaces); pub fn main(init: std.process.Init) !void { - var server: http.Server = try .init( + try http.serve( init.gpa, - try .parseLiteral("0.0.0.0:8080"), routes, + try .parseLiteral("0.0.0.0:8080"), ); - try server.serve(init.gpa); -} - -test { - _ = std.testing.refAllDecls(@This()); } |