0.0.4 • Published 7 years ago

ta-reserror v0.0.4

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

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"}
  }
})
0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago