Skip to main content

Module routes

Module routes 

Source
Expand description

The HTTP route table and frontend fallback. Split out of server/mod.rs unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md §4.1).

Structs§

SrvRouters
The two routers srv serves. full is every route and is bound on loopback only. lan is what backend::lan_listeners binds on LAN interfaces when LAN discovery is on: the routes a LAN peer calls (all behind lan_or_full_auth_middleware), plus health and the WhatsApp webhook, which authenticate themselves. Nothing that requires the full auth_key is served off-host, so a LAN listener has no full-key surface.

Functions§

build_routers
Build both routers with all routes, auth middleware, and CORS.
build_routers_with 🔒
build_routers, with the frontend directory passed in (headless --frontend-dir, or None).
with_frontend 🔒
Serve the built frontend in dir for every path no route claims, / included. Unauthenticated, like the CEF host’s static server: the bundle holds no secrets, and srv’s key still guards every API route. Unknown paths get index.html. Full router only; the LAN router never serves it.