Skip to content

Comment on Express 5.0 – Last Pushparent

Comments

Sure, but that doesn’t seem very relevant to this thread. Also in express there are certainly ways to do what you say, for instance you could make a middleware like the following:

    app.use(async (req, res, next) => {
      console.log("Request is going down", req.body)
      await next()
      console.log("Response is coming up", res.data)
      res.send(res.data)
    })

    app.get("/", function (req, res) {
      res.data = { content: "Hello World" }
    })
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.