?print-pdf' Created by
-g option.
# navigate to your project root folder
$ cd /path/to/TodoApp
# install locally json-server package as dev dependency:
npm install json-server --save-dev
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
Do not close (or press CTRL+C) the Terminal, as the server will be killed!
| Method | Path (Route) | Action |
|---|---|---|
| GET | /todos | get all todos |
| GET | /todos/id | get Todo by id |
| POST | /todos | add new Todo |
| PUT | /todos/id | update Todo by id |
| DELETE | /todos/id | remove Todo by id |
These slides are based on
customised version of
framework