middleware01.js

Home   »   middleware01.js

const express = require("express");
const app = express();

app.get("/posts", (req, res, next) => {
  console.log("This code will execute first");
  next();
});

app.get("/posts", (req, res) => {
  res.send("You made a GET request to posts page.");
});

app.listen(3000, () => {
  console.log("Server is running on port: 3000");
});

Leave a Reply

Your email address will not be published.