A Node RESTful API that enables users to add tasks to their todo list.
Technologies Used: Node.js - Express.js - JavaScript - MongoDB - Mongoose - Jest
- CRUD Operations for Users & Tasks using Mongoose.
- Validation & Sanitization of Data with Mongoose & Express-Validator
- Securely Storing Passwords with bcryptjs
- Authorization & Authentication with JWT.
- Sorting, Filtering & Pagination.
- File Uploads with Multer.
- Resizing Images with Sharp.
- Sending Emails with SendGrid
- Unit Testing with Jest.
Clone the project
git clone https://github.com/Ahmed-Yassen/tasks-app.git
Go to the project directory
cd tasks-app
Install dependencies
npm install
Create config directory
mkdir config
Go to the config directory & create env files for development & tests
cd config
touch dev.env test.env
In each env file add the following variables & their values
PORT= **the available port number on your machine**
SENDGRID_API_KEY= **your sendgrid api key**
JWT_SECRET= **your jwt secret**
MONGODB_URL= **the url to your mongodb server with the database name of your choice**
Go back to the root directory
cd ..
Start the server
npm run start
Run the tests (optional)
npm run test
POST /api/auth/signup
Parameter | Type | Description |
---|---|---|
email |
string |
Required. should be valid email that contains @ and domain |
password |
string |
Required. should contain only numbers & letters, min length 8 characters |
name |
string |
Required. Your name |
age |
number |
Optional. Your age, should be atleast 10 |
POST /api/auth/login
Parameter | Type | Description |
---|---|---|
email |
string |
Required. should be valid email that contains @ and domain |
password |
string |
Required. should contain only numbers & letters |
POST /api/auth/logout
Parameter | Type | Description |
---|
POST /api/auth/logoutall
Parameter | Type | Description |
---|
GET /api/users/profile
PATCH /api/users/profile
Parameter | Type | Description |
---|---|---|
email |
string |
Optional. should be valid email that contains @ and domain |
password |
string |
Optional. should contain only numbers & letters |
name |
string |
Optional. Your name |
age |
number |
Optional. Your age, should be atleast 10 |
DELETE /api/users/profile
Parameter | Type | Description |
---|
POST /api/users/profileImage
Parameter | Type | Description |
---|---|---|
image |
file |
Required. should be an image, with (.png / .jpg / .jpeg) extention |
DELETE /api/users/profileImage
Parameter | Type | Description |
---|
POST /api/tasks
Parameter | Type | Description |
---|---|---|
description |
string |
Required. The task's description |
isCompleted |
boolean |
Optional. Whether or not the task has been completed. (defaults to false) |
GET /api/tasks
GET /api/tasks?isCompleted=true
GET /api/tasks?sortBy=description:asc
GET /api/tasks?sortBy=createdAt:desc
GET /api/tasks?sortBy=isCompleted:asc
GET /api/tasks?limit=3
GET /api/tasks?skip=3
PATCH /api/tasks/:id
Parameter | Type | Description |
---|---|---|
id |
mongoId |
Required. The task's id |
description |
string |
Optional. The task's description |
isCompleted |
boolean |
Optional. Whether or not the task has been completed. (defaults to false) |
DELETE /api/tasks/:id
Parameter | Type | Description |
---|---|---|
id |
mongoId |
Required. The task's id |
If you have any feedback, please reach out to me at ahmed.ibrahim.yassen@gmail.com