Hacker News new | ask | show | jobs
by basil-rash 773 days ago
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" }
    })