The API allows you to:
- Create and login a user;
- Create, edit and delete task if user is verified using JWT (Json Web Token);
- Node.JS
- Cors
- Express
- Express-rescue
- Joi
- Jsonwebtoken
- Mongodb
Live deploy of this project is available in Heroku.
npm install
npm star
npm run dev
GET /
{
"connection": true
}
POST /signup
Header:
Content-Type: application/json'
Body:
{
"email": "test@test.com",
"firstName": "John",
"lastName": "Snow",
"password": "123456"
}
{
"userId": "615f2c7d5a6be903d3d1a034"
}
POST /login
Header:
Content-Type: application/json'
Body:
{
"email": "test@test.com",
"password": "123456"
}
{
"token": "JWT",
"user": {
"_id":"615f2c7d5a6be903d3d1a034",
"email":"test@test.com",
"firstName":"John",
"lastName":"Snow"
}
}
POST /tasks/create
Header:
Content-Type: application/json'
Authorization: JWT
Body:
{
"task":"test"
}
{
"taskId": "615f31235a6be903d3d1a035"
}
GET /tasks
Header:
Content-Type: application/json'
Authorization: JWT
{
"tasks": [
{
"_id": "615f31235a6be903d3d1a035",
"userId": "615f2c7d5a6be903d3d1a034",
"text": "test",
"status": "pending",
"created": "2021-10-07T17:40:51.679Z"
}
]
}
GET /tasks/id
Header:
Content-Type: application/json'
Authorization: JWT
{
"_id": "615f31235a6be903d3d1a035",
"userId": "615f2c7d5a6be903d3d1a034",
"text": "test",
"status": "pending",
"created": "2021-10-07T17:40:51.679Z"
}
PUT /tasks/id
Header:
Content-Type: application/json'
Authorization: JWT
Body:
{
"task":"test modified"
}
{
"_id": "615f31235a6be903d3d1a035",
"userId": "615f2c7d5a6be903d3d1a034",
"text": "test modified",
"status": "pending",
"created": "2021-10-07T17:40:51.679Z",
"lastUpdate": "2021-10-07T17:41:15.359Z"
}
PUT /tasks/check/id
Header:
Content-Type: application/json'
Authorization: JWT
Body:
{
"task":"test modified"
}
{
"_id": "615f31235a6be903d3d1a035",
"userId": "615f2c7d5a6be903d3d1a034",
"text": "test modified",
"status": "done",
"created": "2021-10-07T17:40:51.679Z",
"lastUpdate": "2021-10-07T17:43:43.375Z"
}
DELETE /tasks/id
Header:
Content-Type: application/json'
Authorization: JWT
true