Daily task API provides a gateway to store user tasks and allows users to do CRUD functionality.
- Allow users to create an account.
- Login user based on credentials.
- Store task.
- Provide a list of tasks to the right user.
- Delete task.
npm install
npm start
npm run start:dev
https://www.getpostman.com/collections/dd23329f56c416aba3fc
Daily Task RESTapi example described below
POST /auth/register
curl -i -H 'Accept: application/json' http://localhost:5000/auth/register
body
{
"fullname": "Biruk Endris",
"username": "for_the_sake_of_username",
"password": "for_the_sake_of_password"
}
HTTP/1.1 200 OK
Date: Thu, 24 Feb 2011 12:36:30 GMT
Status: 200 OK
Connection: close
Content-Type: application/json
[
{
"acknowledged": true,
"insertedId": "622a0c5688579a35c69aebe3"
}
]
POST /auth/login
curl -i -H 'Accept: application/json' http://localhost:5000/auth/login
body
{
"username": "for_the_sake_of_username",
"password": "for_the_sake_of_password"
}
HTTP/1.1 200 OK
Date: Thu, 24 Feb 2011 12:36:30 GMT
Status: 200 OK
Connection: close
Content-Type: application/json
[
{
"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
ODg1NzlhMzVjNjlhZWJlMyIsInVzZXJuYW1lIjoiZm9yX3RoZV9zYWtlX29mX3VzZXJuYW1lIiwk1MTUxNDZ9.
GbGM5qNLDDHLqCjdWU",
"user": {
"id": "622a0c5688579a35c69aebe3",
"fullname": "Biruk Endris"
}
}
]
POST /auth/register
curl -i -H 'Accept: application/json' http://localhost:5000/task
header
"jwt_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
ODg1NzlhMzVjNjlhZWJlMyIsInVzZXJuYW1lIjoiZm9yX3RoZV9zYWtlX29mX3VzZXJuYW1lIiwk1MTUxNDZ9.
GbGM5qNLDDHLqCjdWU"
HTTP/1.1 200 OK
Date: Thu, 24 Feb 2011 12:36:30 GMT
Status: 200 OK
Connection: close
Content-Type: application/json
[
{
"_id": "622a0ecac1e9227e0b798bf1",
"title": "title from postman",
"description": "description from postman",
"dateTime": {
"date": "10-03-2022",
"time": "14:44:26"
},
"isCompleted": false,
"userId": "622a0c5688579a35c69aebe3"
}
]
POST /auth/register
curl -i -H 'Accept: application/json' http://localhost:5000/task/
header
"jwt_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
ODg1NzlhMzVjNjlhZWJlMyIsInVzZXJuYW1lIjoiZm9yX3RoZV9zYWtlX29mX3VzZXJuYW1lIiwk1MTUxNDZ9.
GbGM5qNLDDHLqCjdWU"
body
{
"task": {
"title": "task title",
"description": "description",
}
}
HTTP/1.1 201 OK
Date: Thu, 24 Feb 2011 12:36:30 GMT
Status: 200 OK
Connection: close
Content-Type: application/json
[
{
"message": "Task added",
"result": {
"acknowledged": true,
"insertedId": "622a0ecac1e9227e0b798bf1"
}
}
]
- Node JS
- Express JS
- MongoDB
you want to see live demo click here
⭐ if you like the project, please leave a star ⭐