Skip to content

Instantly share code, notes, and snippets.

@fictorial
Last active April 2, 2019 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fictorial/51e81a32036cea06a13826d4ddfcc8d2 to your computer and use it in GitHub Desktop.
Save fictorial/51e81a32036cea06a13826d4ddfcc8d2 to your computer and use it in GitHub Desktop.
express "middleware" after request handling
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