Skip to content

Instantly share code, notes, and snippets.

@gaetan-cordonnier
Last active December 14, 2020 10:49
Show Gist options
  • Save gaetan-cordonnier/17b95e5653824d46c202324413255950 to your computer and use it in GitHub Desktop.
Save gaetan-cordonnier/17b95e5653824d46c202324413255950 to your computer and use it in GitHub Desktop.
Middlewares dans Express
const express = require("express");
const port = 3000;
const app = express();
// route superMiddleware + function middleware
app.get(
"/superMiddleware",
(req, res, next) => {
res.send("hello world");
next();
},
function (req, res, next) {
console.log("hello middleware");
next();
}
);
app.listen(port, () => {
console.log(`Server is runing on 3000`);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment