This project implements a backend application for managing todos with user authentication, CRUD operations, pagination, search functionality, and special handling for pinned todos. Users can sign up, sign in, create, update, delete, search, and prioritize todos as favorites or pinned items. The application stores data in MongoDB.
Secure authentication using JSON Web Tokens (JWT) to protect API endpoints. Users obtain a JWT token upon successful authentication, which is required for accessing protected routes.
Users can create new todos by sending a POST request to /api/todos.
Retrieve todos with options for pagination and search by title. Pinned todos are returned first in the listing.
Update an existing todo's details, including title, description, and pinned status.
Remove a todo from the list.
Todos marked as pinned are prioritized and returned first in API responses, ensuring users can easily access their most important todos.
Users can mark todos as favorites for quick access and personal organization.
- Node.js
- Express.js
- MongoDB (Mongoose)
- JSON Web Tokens (JWT) for authentication
- Postman for API testing
To get a local copy up and running follow these simple steps.
- Node.js installed on your machine
- MongoDB installed and running locally or a remote MongoDB instance
- Sign Up:
POST /api/auth/signup
- Sign In:
POST /api/auth/signin
- Create Todos:
POST /api/todos
- Update Todo:
PUT /api/todos/:id
- Get Todos:
GET /api/todos?page=1&limit=10&search=keyword
- Delete Todo:
DELETE /api/todos/:id
- Mark Todo as Favorite:
PUT /api/todos/:id/favorite
- Mark Todo as Pinned:
PUT /api/todos/:id/pinned