Connect or Express middleware to modify the response.body [closed]

You don’t need to listen to any events. Just make it

function modify(req, res, next){
  res.body = res.body + "modified";

  next();
}

And use it after you use the router. This way after all your routes have executed you can modify the body

Leave a Comment