:id per parametri dinamici API Mocking Tool for Federico Calo's Projects
Define mock API routes and generate configurations for json-server or Express.js.
:id per parametri dinamici :id per parametri dinamici Come utilizzare Generatore Mock Server
Define Mock Routes
Add one or more routes specifying HTTP method (GET, POST, PUT, DELETE, PATCH), path (use :id for dynamic parameters), response status code and optional delay in milliseconds.
Customize the response JSON body
Modify the response body of every route in the integrated JSON editor. The tool validates syntax in real-time and signals any errors before generating output.
Choose output format
Pass through the sheets "db.json (json-server)" and "Express.js Router" to generate respectively a JSON-server database or an Express.js router ready for use, then copy or download the file.
Or else create a new db.json file.
Use the "Import" button to attach an existing db.json file: the tool automatically generates the 5 CRUD routes (GET list, POST, GET single, PUT, DELETE) for each found collection.
Suggerimenti
- Use :id in the path (e.g. /api/users/:id) to generate dynamic parameters compatible with both json-server and Express.js.
- Set different status codes from 200 (e.g. 401, 404, 500) on dedicated routes to test error handling in your frontend without modifying the real backend.
Domande frequenti
What is the difference between output JSON-Server and Express.js?
JSON-Server generates a db.json file that feeds the npm json-server package, only GET routes are transformed into collections. Express.js generates a complete router.js with all routes (GET, POST, PUT, DELETE, PATCH) and their respective status codes, delays, and response bodies to be mounted in an existing Express app using app.use().
How does importing from an existing db.json file work?
Adding a JSON object with key = collection name and value = array of elements, the tool creates automatically 5 routes for every collection: GET /api/
What is the delay field (ms)?
The delay simulates the network latency of a real API. In Express.js output, it is translated into a setTimeout before sending the response, useful for testing states of loading and race conditions in the frontend.
What happens if the response body JSON is not valid?
The tool signals the syntax error under the affected field and does not block the generation of the output. In Express.js, a route with an invalid JSON still produces a body
Are my routes and data saved somewhere?
No, all generation happens client-side in the browser. No routes, paths or response bodies are sent to a server: you can copy or download the output directly from the page.