Skip to content

Backend Stubs

Paulo Gomes da Cruz Junior edited this page Aug 27, 2026 · 1 revision

Backend Component — Stubs

The Waste Plus application uses WireMock for frontend development and local testing.

Stub Locations

Stubs are co-located with the frontend project for convenience:

  • Mapping Definitions: frontend/stub/mappings/*.json
  • Body Files: frontend/stub/__files/**/*.json

Naming Convention

Stub files should be named after the domain they represent (e.g., codes.json, search.json).

Example Stub

A typical mapping file defines the request match and the corresponding response:

{
  "name": "Assess area statuses",
  "request": {
    "url": "/api/codes/assess-area-statuses",
    "method": "GET"
  },
  "response": {
    "status": 200,
    "bodyFileName": "codes/assess-area-statuses.json"
  }
}

Adding New Stubs

  1. Add the body JSON to the appropriate folder in frontend/stub/__files/.
  2. Create or update the mapping definition in frontend/stub/mappings/.
  3. Ensure the url in the mapping matches the backend endpoint.

Waste Plus Wiki

Home

Architecture

Codes

Decisions

Knowledge Base

Development

Changes

Clone this wiki locally