edon
Version:
A middleware for modifying JSON responses from REST APIs.
20 lines (14 loc) • 344 B
JavaScript
var Edon = function(out) {
return function(req, res, next) {
var _write = res.write;
res.write = function (data) {
var json = JSON.parse(data.toString());
out(json);
result = JSON.stringify(json);
console.log(result);
_write.call(res, result);
};
next();
};
};
module.exports.Edon = Edon;