Skip to content

Instantly share code, notes, and snippets.

@alyson-b69
Created September 28, 2020 09:13
Show Gist options
  • Save alyson-b69/ba588d7c79d0a525db676c0cfb52e1b4 to your computer and use it in GitHub Desktop.
Save alyson-b69/ba588d7c79d0a525db676c0cfb52e1b4 to your computer and use it in GitHub Desktop.
middelware quest
const express = require("express");
const app = express();
const port = 3000;
app.get("/supermiddleware", middleware, (req, res) => {
res.send("Hello World !");
});
function middleware(req, res, next) {
console.log("Hello middleware");
next();
}
app.listen(port, (err) => {
if (err) {
throw new Error("Something bad happened...");
}
console.log(`Server is listening on ${port}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment