Get your own Node server
const express = require('express');
const app = express();

// First middleware
app.use((req, res, next) => {
  console.log('Middleware 1: This always runs');
  next();
});

// Second middleware
app.use((req, res, next) => {
  console.log('Middleware 2: This also always runs');
  next();
});

// Route handler
app.get('/', (req, res) => {
  res.send('Hello World!');
});

// Start the server
const PORT = 8080;
app.listen(PORT, () => {
  console.log(`Server running on port ${PORT}`);
  console.log('Try making a request to http://localhost:8080/');
});

              
Server running on port 8080
Try making a request to http://localhost:8080/
Middleware 1: This always runs
Middleware 2: This also always runs
Hello World!