code wiki / _hdl_build / nx_meet_serve.nx
nx_meet_serve.nx source
↩ module page · 29 lines · 1162 B
1// nx_meet_serve.nx -- the NISHI MEET platform's live HTTP daemon: bind a port and serve POST /apply +
2// /request-talent through the gated chain (screen -> sanitize -> persist -> respond). Thin wrapper over
3// nx_meet_serve_lib. Run with a port arg to start; run with NO arg (the build smoke) it prints usage and
4// exits WITHOUT binding (so building it never hangs on accept). license_tier: ORIGINAL
5// run live: nx_meet_serve.elf <port>
6import "nx_syscalls.nx"
7import "nx_meet_lib.nx"
8import "nx_meet_serve_lib.nx"
9
10func matoi(s: *u8) -> i64 {
11 var v: i64 = 0; var i: i64 = 0
12 while s[i] != (0 as u8) {
13 let c: i64 = s[i] as i64
14 if c >= 48 { if c <= 57 { v = v * 10 + (c - 48) } }
15 i = i + 1
16 }
17 return v
18}
19
20func main(argc: i64, argv: *i64) -> i64 {
21 if argc < 2 {
22 mputs("nx_meet_serve: usage: nx_meet_serve <port> (POST /apply, /request-talent). Not started (no port arg).\n" as *u8)
23 return 0
24 }
25 let port: i64 = matoi(argv[1] as *u8)
26 mputs("nx_meet_serve: listening on :" as *u8); mnum(port); mputs(" routes: POST /apply, POST /request-talent\n" as *u8)
27 meet_serve(port)
28 return 0
29}