π Epytodo
Epytodo is a backend REST API designed to manage a Todo List application. Built with Node.js and Express, it interacts with a MySQL database to manage users and their respective tasks.
π Features
- User Management: Registration and Login with secure authentication.
- Task Management: Create, Read, Update, and Delete (CRUD) tasks.
- Security:
- Passwords hashed using
bcryptjs. - Routes protected via JSON Web Tokens (JWT).
- Passwords hashed using
- Architecture: Clean MVC-like structure separating routes, controllers, and database queries.
π οΈ Tech Stack
- Runtime: Node.js
- Framework: Express.js
- Database: MySQL (via
mysql2) - Authentication: JWT (
jsonwebtoken) - Environment:
dotenv
βοΈ Installation & Setup
1. Clone the repository
git clone [https://github.com/noecrn/epytodo.git](https://github.com/noecrn/epytodo.git)
cd epytodo
2. Database Setup
You need a MySQL server running. Import the provided SQL file to create the database and tables (user and todo).
mysql -u root -p < epytodo.sql
3. Environment Variables
Create a .env file at the root of the project with the following configuration :
MYSQL_DATABASE=epytodo
MYSQL_HOST=localhost
MYSQL_USER=root
MYSQL_ROOT_PASSWORD=yourpassword
PORT=3000
SECRET=your_jwt_secret_key
4. Install Dependencies
npm install
5. Run the Server
npm start
π API Endpoints
Authentication
| Method | Endpoint | Description |
|---|---|---|
POST |
/register |
Register a new user |
POST |
/login |
Log in and receive a JWT token |
Users
- Requires
Authorizationheader with a valid Bearer Token.*
| Method | Endpoint | Description |
|---|---|---|
GET |
/user |
View currently logged-in user information |
GET |
/user/todos |
View all tasks associated with the current user |
GET |
/users/:id |
View specific user information |
PUT |
/users/:id |
Update user information |
DELETE |
/users/:id |
Delete a user |
Todos (Tasks)
Requires Authorization header with a valid Bearer Token.
| Method | Endpoint | Description |
|---|---|---|
GET |
/todos |
View all todos |
GET |
/todos/:id |
View a specific todo |
POST |
/todos |
Create a new todo |
PUT |
/todos/:id |
Update a todo |
DELETE |
/todos/:id |
Delete a todo |
π Project Structure
.
βββ config/ # Database connection configuration
βββ middleware/ # Auth and Error handling middlewares
βββ routes/ # API Route definitions
β βββ auth/
β βββ todos/
β βββ user/
βββ src/ # Main source folder
βββ .env # Environment variables
βββ epytodo.sql # Database schema
βββ index.js # Entry point
βββ package.json
π₯ Authors
NoΓ© Cornu - Engineering Student @ EPITA
On this page
Contributors
Created May 9, 2024
Updated February 11, 2026