aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
blob: bb8b34d99f073de17ca8a76b54184bd31d77db38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//! This is the main executable file.
//! Here we will add all cli interfaces
//! to interact with the state of the application
//! but also the actual running of the server / webapp.

const std = @import("std");
const http = @import("http");
const api = @import("api");

const z = @import("z");
const wasm = @embedFile("wasm");

const routes: http.RouteSet = .init(&([_]http.handler.Interface{
    http.handler.Static(.index, z.app.create(.{ .name = "Memora" }), "text/html").interface(),
    http.handler.Static(.{"index.wasm"}, wasm, "application/wasm").interface(),
}) ++ api.interfaces);

pub fn main(init: std.process.Init) !void {
    try http.serve(init.gpa, routes, .{
        .address = try .parseLiteral("0.0.0.0:8080"),
    });
}