npm install
npm start
- open app on http://localhost:3000
Backend is a json-server on a static json file located in todomvc/data.json
.
Just a short API documentation for our todo app.
Returns an array of all todo items.
Creates a todo item.
Example of an item payload:
{
"title": "buy milk",
"completed": false,
"id": 1
}
Edits todo item, usually to change completed
state. {id} stands for todo id.
Example payload:
{
"completed": true
}
Deletes todo item with given id.
Deletes all todos.
Seed an array of todos. Payload needs to be an array of objects, containing todos. This request rewrites all todos.
Creates a new account. Example payload:
{
"email": "[email protected]",
"password": "abc123"
}
Example error statuses:
409 (Conflict)
- Account already exists
401 (Unauthorized)
- Email or password was not provided
Request headers:
sendwelcomeemail: true
- Sends welcome email to signed up user
Response headers:
Set-Cookie: "auth=true;"
Logs into a new account.
Example payload:
{
"email": "[email protected]",
"password": "abc123"
}
Response headers:
Set-Cookie: "auth=true;"
Example error statuses:
401 (Unauthorized)
- Wrong email or password
Deletes all todos and all accounts.
Deletes all accounts.
Seed an array of accounts. Payload needs to be an array of objects, containing accounts. This request rewrites all accounts.