好吧,您可以覆盖send函数:
app.use(function (req, res) { var send = res.send; res.send = function (body) { // It might be a little tricky here, because send supports a variety of arguments, and you have to make sure you support all of them! // Do something with the body... send.call(this, body); };});如果您想支持的不仅仅是调用
send(例如调用
end方法),那么您就必须重写更多的函数…
您可以检查connect-livereload以了解如何将脚本添加到任何html输出中。



