We can create our own routes by JSON Server without any scripts.
Version
JSON Server 0.17.1
Route Mapping
routes.json
{
"/api/posts": "/posts",
"/api/posts/:id": "/posts/:id"
}
- Create
route.json
under JSON Server folder - Map our own routes to original routes
Apply New Route
$ json-server db.json --routes routes.json
routes
:apply new route toroutes.json
Conclusion
- Just create
routes.json
to define our own routes