Skip to main content

Module fixtures_api

Module fixtures_api 

Source
Expand description

Fixtures management API for hosted-mock deployments Fixtures management API for hosted-mock deployments.

The admin UI calls /__mockforge/fixtures/* for list/create/delete/ download. Those routes live on the admin server (port 9080), which isn’t exposed publicly on hosted-mock Fly machines — only port 3000 is. So UI calls 404’d against the deployed instance. This module mounts an equivalent surface on the main HTTP app so it’s reachable from the cloud-side admin UI through the deployed instance.

§Storage

Fixtures are written as JSON files into MOCKFORGE_FIXTURES_DIR (default /app/fixtures). The startup-time CustomFixtureLoader already reads from there, so newly-uploaded fixtures take effect on the next deploy/restart. Live reload is a separate concern (would require rebuilding the OpenAPI registry mid-flight).

§Endpoints (mounted under /__mockforge/fixtures)

  • `GET / → list fixtures
  • `POST / → create or upsert by name
  • `GET /{id}/download → return raw JSON content
  • `DELETE /{id} → remove
  • `DELETE /bulk → remove many (ids in JSON body)

Structs§

CreateFixturePayload
JSON body accepted by POST /__mockforge/fixtures.
FixtureInfo
Public list-shape entry returned by the fixtures API.
FixturesApiState
Configuration for the fixtures API. Cheap to clone.

Functions§

fixtures_api_router
Build the fixtures API router. Mount under /__mockforge/fixtures.