Package Exports
- modify-response-middleware
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (modify-response-middleware) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
modify-response-middleware
Middleware that allows you to modify the response data.
Installation
$ npm i modify-response-middleware
Node.js
import express from 'express'
import modifyRes from 'modify-response-middleware'
const app = express()
app.use(modifyRes((content, req, res) => {
const data = JSON.parse(content.toString())
data.age += 2
return Buffer.from(JSON.stringify(data))
}))
app.get((req, res) => {
res.json({
name: 'Tom',
age: 18,
})
})
app.listen(3000)
License
MIT