Last active
December 14, 2020 10:49
-
-
Save gaetan-cordonnier/17b95e5653824d46c202324413255950 to your computer and use it in GitHub Desktop.
Middlewares dans Express
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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