Skip to content

Instantly share code, notes, and snippets.

@jinalshah999
Created January 30, 2021 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jinalshah999/15be5ab635385f05e4ec82a175ba44d5 to your computer and use it in GitHub Desktop.
Save jinalshah999/15be5ab635385f05e4ec82a175ba44d5 to your computer and use it in GitHub Desktop.
class Response {
constructor(app) {
app.use((req,res,next) => this.bindResponse(req,res,next));
}
bindResponse(req,res,next) {
this.request = req;
res.sendResponse = (response) => {
res.json({
status: 'success',
data: response
});
};
next();
}
}
module.exports = Response;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment