Created
September 28, 2020 09:13
-
-
Save alyson-b69/ba588d7c79d0a525db676c0cfb52e1b4 to your computer and use it in GitHub Desktop.
middelware quest
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 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