Endpoint configuration
Configure Mock REST API Endpoints
A Mock API Studio resource maps a route path to a TypeScript response type and an explicit set of CRUD operations. The local Express runtime exposes only the methods you enable and returns real 404 responses for unknown resources or records.
Create a resource route
Choose a unique project path such as /products, bind an exported model, and choose whether the response is a collection or a single object. Collection resources support item routes; single-object resources operate only at the root path.
Path: /products
Response: Product[]
Operations: GET, POST, PUT, PATCH, DELETE
Record count: 25Choose supported operations
Enable GET, POST, PUT, PATCH, and DELETE independently. A method that is not configured is not exposed. POST creates state, PUT replaces a record, PATCH updates selected fields, and DELETE removes it from the local SQLite dataset.
GET /products
GET /products/:id
POST /products
PUT /products/:id
PATCH /products/:id
DELETE /products/:idUse collection and single-object responses
Collection bindings generate multiple records and item routes. A single-object binding generates one root object and does not create /:id routes. Choose the response shape that matches the frontend contract instead of wrapping it later.
Call the local endpoint
Start the CLI, then use the printed localhost base URL from fetch, curl, or an API client. The runtime also publishes its current OpenAPI document and Swagger UI.
const response = await fetch("http://localhost:4000/products");
if (!response.ok) throw new Error("Products unavailable");
const payload = await response.json();Related questions
Can I add arbitrary custom actions?
Not currently. Endpoint behavior is resource-oriented CRUD plus generated nested relationship routes.
Keep exploring
Last updated September 17, 2026. Product behavior described here is verified against the current Mock API Studio runtime.