Skip to main content

Module routes

Module routes 

Source
Expand description

HTTP route modules, one per resource. Each exposes a plain pub fn router() -> axum::Router<AppState>, merged together in crate::build_router.

Modules§

capabilities
config
GET/PUT /api/config for the mutable global TOML policies and tune settings.
demo
Restricted simulator-only public Demo API.
draft
GET/PUT /api/runs/draft for the app-wide New Tune form draft.
health
GET /api/health – an unauthenticated liveness probe, deliberately the only endpoint that touches neither crate::state::AppState nor the database: a load balancer or the Windows Service manager (server-windows-service) needs to be able to tell “the process is up and answering HTTP” apart from “the process is up but the database is unreachable” (the latter would fail on essentially every other route already). It also exposes the server package version for the web application’s shell.
history
Run-history routes: GET /api/runs (filtered, paginated list), GET /api/runs/{id} (full run detail: config, initial readings, samples, results, writes), GET /api/runs/{id}/export (CSV/JSON sample export), and DELETE /api/runs/{id}.
opc
OPC DA diagnostic routes: GET /api/opc/servers, GET /api/opc/capabilities, GET /api/opc/browse, DELETE /api/opc/browse/sessions/:id, GET /api/opc/search, GET /api/opc/read, and the indexed-search status/refresh/control routes – back the GUI’s server dropdown, typed tag-tree browser, namespace search, index management, and connection test.
runs
POST /api/runs (start a new tune run) and POST /api/runs/{id}/cancel (request its cancellation) – the write side of the run-history API routes::history reads from.
stream
GET /api/runs/{id}/stream – pushes per-tick engine state to the browser over Server-Sent Events as a run progresses, so the frontend’s live trend chart doesn’t have to poll GET /api/runs/{id} and re-fetch the whole (ever-growing) samples array once a second, the way frontend/src/api/runs.ts’s useRun interim-substitute polling did before this endpoint existed (frontend-live-stream, the last piece frontend-screens was blocked on).
templates
Template CRUD routes: GET /api/templates, GET /api/templates/{name}, POST /api/templates, PUT /api/templates/{name}, DELETE /api/templates/{name}.