Setup API Project – Step 2
Step 2: -Setup API Project
- Download NodeJS
- Create a new folder with any Name
- Open this folder with any Editor like VS Code
- Crete a file Server.js for the entry point
- Crete package. json file via npm init command on terminal by use ctrl ~ Shortcut
- Install dependency npm i express i.e. Fast, minimalist web framework for node
- Install dependency npm i dotenv i.e. zero-dependency module that loads environment variables from environment file into process.env
- Install dev Dependency npm i –D nodemon i.e. A tool that helps develop node.js based applications by automatically restarting the node application when file changes
- Now set the package. json for production and development mode; by default, its development mode to run nodemon but for production we have to mention in script of start the run node like this
scripts": {
"start": "SET NODE_ENV=PRODUCTION node server",
"dev": "nodemon server"
},
after lot of search finally found the right blog.