0.0.4 • Published 7 years ago
ta-reserror v0.0.4
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"}
}
})