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.
- 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.
- Runtime: Node.js
- Framework: Express.js
- Database: MySQL (via
mysql2) - Authentication: JWT (
jsonwebtoken) - Environment:
dotenv
git clone [https://github.com/noecrn/epytodo.git](https://github.com/noecrn/epytodo.git)
cd epytodo
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
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
npm install
npm start
| Method | Endpoint | Description |
|---|---|---|
POST |
/register |
Register a new user |
POST |
/login |
Log in and receive a JWT token |
- 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 |
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 |
.
├── 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
Noé Cornu - Engineering Student @ EPITA