Todo API
- server: node & express
- database: mongoDB & mongoose
- authentication & safety: jsonwebtoken & bcryptjs
npm install
create new user accountPOST /users with body:
{
"email": "[email protected]",
"password": "somePassword"
}
If your data is validated, you will get response with header which contains your x-auth token.
loginPOST url/users/login:
{
"email": "[email protected]",
"password": "somePassword"
}
and in addition you have to send header with generated x-auth token.
delete user tokenDELETE /users/me/token with x-auth token in header.get todos from DBGET /todos with your x-auth token in header.add todos to DBPOST /todos:
{
"text": "Some text.."
}
with x-auth token in header. In response you will get for example:
{
"completed": false,
"completedAt": null,
"_id": "5a9d8bbec309f20014bb5fd5",
"text": "Some text..",
"_author": "author_id",
"__v": 0
}
delete todo from DBDELETE /todos/id with x-auth token in header.
Live on heroku: here