Created
January 30, 2021 11:41
-
-
Save jinalshah999/15be5ab635385f05e4ec82a175ba44d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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