app listen in node js

  1. Import the required modules:
const express = require('express');
  1. Create an instance of the Express application:
const app = express();
  1. Define a route handler:
app.get('/', function (req, res) {
  res.send('Hello World!');
});
  1. Make the application listen on a specific port:
app.listen(3000, function () {
  console.log('Example app listening on port 3000!');
});