A Super-Quick Guide to Getting Started with Node.js & Express.js

Download & install node.js — https://nodejs.org/en/download/
Make your project directory. In your project directory add an index.js file
mkdir my-node-app
cd my-node-app
touch index.js
Initialize your node app.
npm init -y
Note: -y tag accepts the default criteria. Without it, you will be asked to make edits and accept criteria prior to initialization. Either way, the accepted information can be found in the package.json file and can be edited at any time.
Install Express.js
npm install express
Confirm express was installed by looking for it in the package.json file under dependencies.
touch .gitignore
To create a .gitignore file. Add node_modules to your .gitignore file. This prevents node modules from being pushed to Github.
Express Setup
In the index.js file:
Import express
const express = require('express');
Instantiate express application
const app = express()
Declare your port number
const port = 4000
Declare your first route/API endpoint
app.get('/', (request, response) => {
response.send('Hello World!')
})
Start the server
app.listen(port, () => {
console.log("listening on port 4000")
})
So, this is what your index.js file should look like now:
