π Todo Backend
This is the backend API for the Todo application β a simple yet powerful task management tool. It handles user authentication, task creation, updates, and deletions, while exposing clean and secure RESTful endpoints.
π Frontend App: https://todo-frontend-rosy-five.vercel.app/
βοΈ Features
π Authentication β Secure user signup and login using JSON Web Token (JWT)
π Todo Management β Create, read, update, and delete todos
π§ Validation β Request data validation for reliability
π§© RESTful API β Clean and predictable endpoint structure
πΎ Database Integration β Uses MongoDB for data persistence
ποΈ Tech Stack
Runtime: Node.js
Framework: Express.js
Database: MongoDB + Mongoose
Auth: JSON Web Token (JWT)
Validation: Joi / custom middleware
π Getting Started
-
Clone the repository git clone https://github.com/your-username/todo-backend.git cd todo-backend
-
Install dependencies npm install
-
Create a .env file
You can copy the contents from .env.example below:
PORT=5000 MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_secret_key
- Start the development server npm run dev
π‘ API Endpoints Method Endpoint Description Auth Required POST /api/auth/signup Register a new user No POST /api/auth/login Login user No GET /api/todos Get all todos Yes POST /api/todos Create a todo Yes PUT /api/todos/:id Update a todo Yes DELETE /api/todos/:id Delete a todo Yes π Project Structure todo-backend/ β βββ controllers/ # Route logic βββ models/ # Mongoose schemas βββ routes/ # API route definitions βββ middleware/ # Auth & error handlers βββ server.js # App entry point βββ .env.example # Example environment variables
π§ͺ Testing
Run tests using:
npm test
π Notes
Ensure MongoDB is running locally or use a cloud service like MongoDB Atlas.
The backend must be running for the Frontend App to function properly.
π License
This project is licensed under the MIT License β you are free to use, modify, and distribute this project with attribution.
π» Author
Desmond Built with β€οΈ and β using Node.js + Express.js