Todolist API is a web service for managing an activity. This APIs built using the REST architecture.
expressjs - Backend Framework
mongodb - Database
mongoose - ODM
jsonwebtoken - Auth
git clone https://github.com/abilsabili50/Todolist-API.git
cd Todolist-API
npm install
mv .env.example .env
npm run start
This route serves as the endpoint for creating new users.
-
Method : POST
-
Endpoint :
/api/register
-
Body :
{ "name": "string", "email": "string", "password": "string" }
-
Response :
{ "status": "string", "msg": "string", "userId": "string" }
This route serves as the endpoint for the user to enter the application.
-
Method : POST
-
Endpoint :
/api/login
-
Body :
{ "email": "string", "password": "string" }
-
Response :
{ "status": "string", "msg": "string", "token": "string" }
This route serves as the endpoint to get all todos.
- Method : GET
- Endpoint :
/api/todo
- Header :
- authorization :
token
- authorization :
- Response :
{ "status": "string", "msg": "string", "data": [ { "id": "number", "title": "string", "status": "boolean" } ] }
This route serves as the endpoint to retrieving a todo.
- Method : GET
- Endpoint :
/api/todo/:id
- Header :
- authorization :
token
- authorization :
- Response :
{ "status": "string", "msg": "string", "data": { "id": "number", "title": "string", "desc": "string", "status": "boolean" } }
This route serves as the endpoint for creating new todos.
-
Method : POST
-
Endpoint :
/api/todo/
-
Header :
- authorization :
token
- authorization :
-
Body :
{ "title": "string", "desc": "string" }
-
Response :
{ "status": "string", "msg": "string", "todoId": "number" }
This route serves as the endpoint for updating a todo.
-
Method : PUT
-
Endpoint :
/api/todo/:id
-
Header :
- authorization :
token
- authorization :
-
Body :
{ "title": "string", "desc": "string", "status": "boolean" }
body may contain at least 1 field between
title
,desc
, andstatus
. -
Response :
{ "status": "string", "msg": "string" }
This route serves as the endpoint for deleting a todo.
- Method : DELETE
- Endpoint :
/api/todo/:id
- Header :
- authorization :
token
- authorization :
- Response :
{ "status": "string", "msg": "string" }
This route serves as the endpoint for deleting all todos.
- Method : DELETE
- Endpoint :
/api/todo/
- Header :
- authorization :
token
- authorization :
- Response :
{ "status": "string", "msg": "string" }
- This code is far from perfect, this code only facilitates crud todo and an authentication system without any logout and encryption system.
- This code is also specially created to complete the task of TPA 5 at MSIB Batch 3 (Skilvul).
- So feel free to fork and copy it for your project or some practice needs.