The project assignment for roadmap.sh
URL of the assignment in roadmap.sh:
https://roadmap.sh/projects/todo-list-api
This API handles todo items in a Postgres database with user authentication and
authorization.
Each todo item has a title and description.
Authorization is handled with JWT.
The API also has rate limiting to prevent abuse.
-
Clone the repository:
git clone https://github.com/ilia-abbasi/Todo-List-API.git cd Todo-List-API -
Install dependencies:
npm install
-
Create the
.envfile inside the/miscdirectory and set the variables:PORT=your_port DB_USER=your_database_username DB_HOST=your_database_host DB_NAME=your_database_name DB_PASS=your_database_password DB_PORT=your_database_port DB_USER_TEST=your_test_database_username DB_HOST_TEST=your_test_database_host DB_NAME_TEST=your_test_database_name DB_PASS_TEST=your_test_database_password DB_PORT_TEST=your_test_database_port JWT_SECRET=your_jwt_secret
You can ignore the
_TESTvariables if you don't want to run tests. -
Create the required tables in your database:
npm run setup
-
If you want to run tests too, create the required tables in your test database:
npm run setup:test
-
Run the server with:
npm run start
-
Send requests using Postman.
- bcryptjs
- dotenv
- express
- express-rate-limit
- express-validator
- jsonwebtoken
- lodash
- morgan
- pg
- @babel/core
- @babel/node
- @babel/preset-env
- @types/jest
- jest
- supertest
The source code is formatted with Prettier.
Read the docs
here.
Todo-List-API is licensed under the
GPL-3.0 license.