Project 6 | OpenClassrooms | Construisez une API sécurisée pour une application d'avis gastronomiques
- Creating back-end of this project to build an API (The front-end of the application was developed using Angular)
- Creating a logical data model and translating it into the API
- Ipmlementing CRUD fonctionalty, Create, Read, Update, and Delete
- Storing data in the database mongoDB
- Protecting data stored on an app (OWASP/RGPD)
- Creating a user, verifying and securing the user's session
https://www.youtube.com/watch?v=ISGOk1S7ecE
In this project, we can create a user using a password and email address. This user can like, dislike or unlike the sauces created by other users, but cannot make any changes or delete these sauces. Users can create their own sauces and only delete or modify their own sauce. The user can log out and reconnect using her/his password and email address.
✳️ Node.js ✳️ Express ✳️ MongoDB ✳️ API REST
-
Open a terminal at the root of the project
-
Run the following command to reach the directory "backend"
cd backend
- Install the dependencies
npm install
- Create a project in mongoDB, specify a user with a specific username and password, and create a cluster
- Create a folder with name of "vars" in the repository "backend", inside "vars" create a file ".env" likes the file .env.example and write the following informations using your own data in this file. [backend/vars/.env]
PORT=3000
DB_USERNAME="your mongoDB user name"
DB_PWD="your mongoDB user password"
DB_CLUSTER="your mongoDB cluster name"
JWT_KEY_TOKEN="Create an API token"
- In this file, write your own MongoDB project user name, password and cluster name
- Generate your own API token and write it also in the file .env for JWT_KEY_TOKEN
- Run backend server with this command
npm start
-
Open a terminal at the root of the project
-
Run the following command to reach the directory "frontend"
cd frontend
- Install the Dependencies
npm install
- Run frontend server with this command
npm run start
- Type the following URL in your browser to reach the application
Password must be 6 characters:
⭐ 1 uppercase letter ⭐ 1 lowercase letter ⭐ 1 special character ⭐ 3 digits