1.Project Folder Creation.
2.Express Server Configuration.
3.MongoDb Configuration.
4.REST API Creation (GET,POST,PUT,DELETE).
5.Testing the APIs using Postman.
1.Project Folder Creation.
npm init -y make the package with default values
2.Express Server Configuration.
install the packages
npm i express nodemon cors mongoose body-parser
-
express
-
nodemon - server is automatically restart when the changes are detected use the nodemon - change the script in package.json file "start": "nodemon server.js"
-
cors
-
mongoose - communicate to the mongoDB Atlas
-
body-parser
run the server - npm start
3.MongoDb Configuration.
- Create a project
- Create a cluster
- Configure Database Access
- Configure Network Access - readWriteAnyDatabase
- Add current IP address - Production level
- Allow access from anywhere - Recommend for this app
4.REST API Creation (GET,POST,PUT,DELETE).
- Create a Model