Setup API Project – Step 2

Setup API Project – Step 2

Step 2: -Setup API Project

  1. Download NodeJS
  2. Create a new folder with any Name
  3. Open this folder with any Editor like VS Code
  4. Crete a file Server.js for the entry point
  5. Crete package. json file via npm init command on terminal by use ctrl ~ Shortcut
  6. Install dependency npm i express i.e. Fast, minimalist web framework for node
  7. Install dependency npm i dotenv i.e.  zero-dependency module that loads environment variables from environment file into process.env
  8. 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
  9. 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"
  },
One thought on “Setup API Project – Step 2

Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *

*

*