Created by
https://jsonplaceholder.typicode.com
GET | /todos | Get all todos |
GET | /todos/1 | Get todo with id=1 |
POST | /todos | Create new Todo |
PUT | /todos/1 | Update Todo with id=1) |
DELETE | /todos/1 | Delete Todo with id=1) |
-g
option.
# navigate to your project root folder
$ cd /path/to/TodoApp
# init the project:
npm init
# install json-server package
npm install json-server
db.json
with next content:
{
"todos":[
{
"id": 1,
"title": "Learn HTML",
"completed": false
},
{
"id": 2,
"title": "Learn CSS",
"completed": false
},
{
"id": 3,
"title": "Learn JavaScript",
"completed": false
}
]
}
./node-modules/.bin/
folder. You can start json-server by:
$ ./node_modules/.bin/json-server --watch db.json
These slides are based on
customised version of
framework