aboutsummaryrefslogtreecommitdiff
path: root/main.ha
diff options
context:
space:
mode:
Diffstat (limited to 'main.ha')
-rw-r--r--main.ha7
1 files changed, 6 insertions, 1 deletions
diff --git a/main.ha b/main.ha
index 0545e81..fc41240 100644
--- a/main.ha
+++ b/main.ha
@@ -2,6 +2,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu <https://runxiyu.org>
// Adapted from template by Willow Barraco <contact@willowbarraco.fr>
+use fs;
use getopt;
use log;
use net;
@@ -21,6 +22,8 @@ const usage: [_]getopt::help = [
('c', "config", "path to configuration file")
];
+let static_fs: nullable *fs::fs = null;
+
export fn main() void = {
const cmd = getopt::parse(os::args, usage...);
defer getopt::finish(&cmd);
@@ -31,10 +34,12 @@ export fn main() void = {
for (let opt .. cmd.opts) {
switch (opt.0) {
case 'c' => yield; // TODO: actually handle the config
- case => abort(); // unreachable
+ case => abort("unreachable");
};
};
+ static_fs = os::diropen("static")!;
+
const server = match (http::listen(ip_addr, port, net::tcp::reuseport, net::tcp::reuseaddr)) {
case let this: *http::server =>
yield this;