A simple and robust Todo API built with Node.js and Express, providing full CRUD operations for managing tasks, along with user authentication, including sign-up, login, and password reset functionality via email.
- 📝 CRUD operations for managing todos (Create, Read, Update, Delete)
- 🔐 User Authentication (Register, Login, Logout)
- ✉️ Password Reset via email
- 🛡️ Secure API using JWT Authentication
- 🏷 Tag Management for todos
- 📄 API Documentation with Swagger (if implemented)
- Clone the repository:
git clone https://github.com/mrrajput04/todo_api.git
- Navigate to the project directory:
cd your-repo-name
- Install dependencies:
npm install
-
Create a
.env
file in the project root and configure the necessary environment variables:PORT=3000 DATABASE_URL=mongodb://localhost:27017/todo-db JWT_SECRET=your_jwt_secret MAIL_HOST=smtp.example.com MAIL_USER=your_email@example.com MAIL_PASSWORD=your_email_password
-
Start the server:
npm start
The API will be available at http://localhost:3000
.
Method | Endpoint | Description |
---|---|---|
GET | / |
API Status Check |
POST | /register |
Register a new user |
POST | /login |
Authenticate user |
POST | /forgot-password |
Request password reset |
POST | /otp-verification |
Verify OTP for password reset |
PUT | /verify-reset-password |
Reset password (requires token) |
POST | /access-token-generate |
Generate new access token |
GET | /verify:email |
Verify user email |
Method | Endpoint | Description |
---|---|---|
POST | /addTodo |
Create a new todo |
POST | /completeTodo |
Mark a todo as complete |
GET | /showTodo |
Get specific user todos |
GET | /all-todo |
Get all todos |
PUT | /updateTodo |
Update an existing todo |
DELETE | /deleteTodo |
Delete a todo |
Method | Endpoint | Description |
---|---|---|
POST | /addTags |
Create new tags |
GET | /allTags |
Retrieve all tags |
GET | /showTag |
Get specific tag details |
PUT | /updateTag |
Update an existing tag |
DELETE | /deleteTag |
Delete a tag |
- Node.js - JavaScript runtime
- Express.js - Web framework for Node.js
- MongoDB / PostgreSQL - Database
- JWT (JSON Web Token) - Authentication
- Nodemailer - Email handling for password reset
- Passwords are securely hashed using bcrypt.
- Authentication is handled using JWT tokens.
- Protected routes require authentication.
This project is licensed under the MIT License.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature-branch
- Make your changes and commit:
git commit -m 'Add new feature'
- Push to your branch:
git push origin feature-branch
- Open a Pull Request.
For any inquiries, reach out to rajpootdivesh5@example.com or open an issue in the repository.
Happy coding! 🚀