I'm trying to create a logger for my own system. I have a problem getting the res.body, i am using morgan as a middleware and wrote cutome tokens for getting req and res body, i can easily get the request body but not response body.
morgan.token('qbody', (req) => {
return JSON.stringify(req.body)
})
morgan.token('sbody', (res) => {
return JSON.stringify(res.body)
})
is there is any way to get the response body?
by using method overloading i sloved this problem