diff options
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 40 |
1 files changed, 9 insertions, 31 deletions
diff --git a/src/main.zig b/src/main.zig index 4ea4954..1a66b63 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,36 +1,14 @@ -const std = @import("std"); -const memora = @import("memora"); - -pub const std_options = std.Options { - .logFn = memora.log.handler, -}; - -fn signal_handler(signo: i32) callconv(.c) void { - if (signo == std.os.linux.SIG.INT) { - server.deinit(); - std.process.exit(0); - } -} +//! 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. -fn register_sigaction() void { - var sa = std.os.linux.Sigaction{ - .handler = .{ .handler = signal_handler }, - .mask = std.mem.zeroes(std.os.linux.sigset_t), - .flags = 0, - }; +const std = @import("std"); - _ = std.os.linux.sigaction(std.os.linux.SIG.INT, &sa, null); +pub fn main(init: std.process.Init) !void { + _ = init; } -var server = memora.Server{}; - -pub fn main() !void { - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; - defer std.debug.assert(gpa.deinit() == .ok); - const allocator = gpa.allocator(); - - const address = try std.net.Address.parseIpAndPort("0.0.0.0:8080"); - try server.init(address, allocator); - register_sigaction(); - server.run(allocator); +test { + _ = std.testing.refAllDecls(@This()); } |