我正在寻找一种方法来访问在控制器的“之后”过滤器中发送回请求者的 JSON。
var locomotive = require('locomotive');
var myController = new locomotive.Controller();
myController.after('myAction', function(next) {
var response = {}; //I want to access the JSON being sent back in myAction: {'hello':'world'}
console.log(response); //this should log "{'hello':'world'}"
next();
});
myController.myAction = function myAction() {
this.res.json({'hello':'world'});
}
module.exports = myController;
如果有人有任何方法可以做到这一点,将不胜感激。