This is an Express application written in TypeScript. It provides a RESTful API for a To-Do List application.The application uses JWT for authentication and Sequelize ORM for database operations.
- User authentication using JWT
- CRUD operations for To-Do List items
- Modular routing using Express Router
- Database operations using Sequelize ORM
- Error handling using Express middleware
- Unit testing using Jest
- Clone the repository
- Run
npm install
to install dependencies - Rename
.env.example
to.env
and update the values - Update the same in jestSetup.js file
- Run
npm run test
to run the unit tests - Run
npm run dev
to start the application in development mode - Run
npm run build
to build the application - Run
npm start
to start the application in production mode
- This API provides endpoints for managing users and their to-do items.
- Postman collection link: here
- Live link: here
- Endpoint:
/users/login
- Method:
POST
- Body:
{
"email": "test@email.com",
"password": "password123"
}
- Endpoint:
/users/register
- Method:
POST
- Body:
{
"email": "tgoyal63@gmail.com",
"username": "tgoyal63",
"password": "tgoyal63"
}
- Endpoint:
/users/profile
- Method:
GET
- Headers:
- Authorization:
Bearer YOUR_TOKEN
- Authorization:
- Endpoint:
/todos
- Method:
POST
- Headers:
- Authorization:
Bearer YOUR_TOKEN
- Authorization:
- Body:
{
"title": "Design DB",
"description": "Design the database architecture for the todo application",
"completed": true
}
- Endpoint:
/todos
- Method:
GET
- Headers:
- Authorization:
Bearer YOUR_TOKEN
- Authorization:
- Endpoint:
/todos/:id
- Method:
GET
- Headers:
- Authorization:
Bearer YOUR_TOKEN
- Authorization:
- Endpoint:
/todos/:id
- Method:
PUT
- Headers:
- Authorization:
Bearer YOUR_TOKEN
- Authorization:
- Body:
{
"title": "New Title",
"completed": true
}
- Endpoint:
/todos/:id
- Method:
DELETE
- Headers:
- Authorization:
Bearer YOUR_TOKEN
- Authorization:
Note: Replace YOUR_TOKEN
with the actual token you receive after logging in or registering.