October 2019
Intermediate to advanced
426 pages
11h 49m
English
By default, the json-server tool defines the following routes: https://github.com/typicode/json-server#routes.
We can also define our own routes, by creating a routes.json file, where we can rewrite existing routes to other routes: https://github.com/typicode/json-server#add-custom-routes.
For our blog app, we are going to define a single custom route: /login/:username/:password. We are going to link this to a /users?username=:username&password=:password query, in order to find a user with the given username and password combination.
We are now going to define the custom login route for our app:
{ "/login/:username/:password": "/users?username=:username&password=:password" ...Read now
Unlock full access