Last active
April 2, 2019 16:26
-
-
Save fictorial/51e81a32036cea06a13826d4ddfcc8d2 to your computer and use it in GitHub Desktop.
express "middleware" after request handling
This file contains 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(); | |
app.use((req, res, next) => { | |
res.once("finish", () => { | |
console.log("finish"); | |
}); | |
next(); | |
}); | |
app.get("/", (req, res) => { | |
console.log("in get"); | |
res.json({ foo: "bar" }); | |
}); | |
app.listen(8777); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment