First commit on new server

This commit is contained in:
Michal Skorczak 2024-11-03 20:18:39 +00:00
parent 0987266cf8
commit 66ab128f3e
4 changed files with 6 additions and 6 deletions

View file

@ -16,7 +16,7 @@ pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
const lib = b.addStaticLibrary(.{
.name = "aoc_zig",
.name = "mskor_zig",
// In this case the main source file is merely a path, however, in more
// complicated build scripts, this could be a generated file.
.root_source_file = b.path("src/root.zig"),
@ -30,7 +30,7 @@ pub fn build(b: *std.Build) void {
b.installArtifact(lib);
const exe = b.addExecutable(.{
.name = "aoc_zig",
.name = "mskor_zig",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,

View file

@ -1,5 +1,5 @@
.{
.name = "aoc_zig",
.name = "mskor_zig",
// This is a [Semantic Version](https://semver.org/).
// In a future version of Zig it will be used for package deduplication.
.version = "0.0.0",

2
run.sh
View file

@ -1,3 +1,3 @@
#!/bin/sh
./build.sh
./zig-out/bin/aoc_zig
./zig-out/bin/mskor_zig

View file

@ -87,10 +87,10 @@ pub fn main() !void {
try router.handle_func("/home", &web_router, &WebRouter.home);
try router.handle_func("/index", &web_router, &WebRouter.index);
try router.handle_func("/", &web_router, &WebRouter.index);
var listener = zap.HttpListener.init(.{ .port = 3000, .on_request = router.on_request_handler(), .log = true, .max_clients = 100000, .public_folder = "src/public" });
var listener = zap.HttpListener.init(.{ .port = 4000, .on_request = router.on_request_handler(), .log = true, .max_clients = 100000, .public_folder = "src/public" });
try listener.listen();
std.debug.print("Listening on 0.0.0.0:3000\n", .{});
std.debug.print("Listening on 0.0.0.0:4000\n", .{});
zap.start(.{
.threads = 2,