feat: multi-origin CORS + msp-api placeholder + calendar route stub #14
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/cors-multi-origin-and-placeholder"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Three related changes for the v0.2.0 milestone:
1. Multi-origin CORS (CORS_ORIGIN env var)
The outer api router now builds
AllowOrigin::list(...)from acomma-separated
CORS_ORIGINenv var. Falls back to[CLIENT_ORIGIN]if unset, so dev is unchanged.
create_api_routergains acors_origins: Vec<String>parameter; the only callsite (main.rs) is updated.Required for the staging/prod split where the SPA (msp.<tld>) and API
(msp-api.<tld>) are different origins.
2. msp-api placeholder fallback
.fallback(get(not_a_frontend))swallows any non-/api/v1/*requestwith a small HTML page that links back to the matching Bunyip apex
(derived by stripping
msp-api.from theHostheader). Browservisits to msp-api.<tld> no longer leak 404 internals;
/api/v1/healthstill returns plain 200 for Traefik.
3. Calendar route stub (
GET /api/v1/calendar/events)First real route in the calendar module. Tenant-scoped via
RequireAuth,filtered by
?from=&to=. Currently returnsVec<CalendarEvent>::new()because there's no persistence yet; a follow-up adds the migration,
repository, and create/update/delete routes. The frontend's progressive
fall-back keeps the calendar usable in the meantime.
🤖 Generated with Claude Code
f1579b750dto7beb7a4dde