• "Create project, add package.json configuration
$ mkdir myapp # create directory
$ cd myapp    # enter the directory
$ npm init -y # Initialize a configuration
  • Install dependencies
$ npm install express
  • Entry file index.js add code:
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => {
  res. send('Hello World!')
})
app. listen(port, () => {
  console.log(`Listening port on ${port}`)
})
  • Run the application using the following command
$ node index.js
Comments