Step 1: install dependency
$ mkdir mydir
$ cd mydir
$ npm init
$ npm install express
Step 2: create the app.js
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`)
})
Step 3: start the server
$ node app.js