|
DeterministicESPAsyncWebServer v6.28.0
Zero-allocation, bounded-execution async HTTP server for ESP32
|
Single-page-app micro-routing decision (DETWS_ENABLE_SPA_ROUTER). More...
Go to the source code of this file.
Single-page-app micro-routing decision (DETWS_ENABLE_SPA_ROUTER).
A single-page web UI does its own client-side routing: the browser navigates to /dashboard or /devices/42, but there is no such file on the device - the server must return the app shell (index.html) and let the JavaScript router take over, while still serving real asset files (/app.js, /style.css) and letting API calls (/api/...) fall through to their handlers. This is that routing decision: given a request path, return whether to serve the file, serve the shell, or pass through to the app.
The rule: a path under a configured API prefix passes through; a path whose last segment has a file extension (a dot) is a real asset request; anything else is a client route and gets the shell. Pure, zero heap, no stdlib, host-testable; the caller wires the result into serve_static / the router.
Definition in file spa_router.h.