REST API Mocking
Complete example of mocking a RESTful API with all CRUD operations.
For complete examples with detailed code, see the REST API Mocking section in MASTER_DOCUMENTATION.md.
HTTP Methods
// GET - Retrieve
handler({ method: 'GET', path: '/users' })
// POST - Create
handler({ method: 'POST', path: '/users', body: {...} })
// PUT - Full replace
handler({ method: 'PUT', path: '/users/1', body: {...} })
// PATCH - Partial update
handler({ method: 'PATCH', path: '/users/1', body: {...} })
// DELETE - Remove
handler({ method: 'DELETE', path: '/users/1' })Status Codes
200- OK201- Created204- No Content400- Bad Request403- Forbidden404- Not Found500- Internal Server Error
Full Documentation
See MASTER_DOCUMENTATION.md for complete REST API examples.