ta-reserror
v0.0.4
Published
response with error middleware
Downloads
1
Readme
Adds a method taReserror
to res
that responds with an error json in convention with TakiAcademy projects:
{success: false, msg: ""}
Install
npm i ta-reserror
Initialize
const taReserror = require('ta-reserror');
app.use(taReserror());
Use
res.taReserror("msg")
Eg:
router.post('admin', function(req, res, next){
if(!req.user.admin){
res.taReserror("You don't have rights to do this");
// responds with: {success: false, msg: "You don't have rights to do this"}
}
})