How to use the InternalServerError function from restify

Find comprehensive JavaScript restify.InternalServerError code examples handpicked from public code repositorys.

77
78
79
80
81
82
83
84
85
86

router.post('/user', (req, res) => {
  if (!req.params.username || !req.params.password || !req.params.email) return res.send(new restify.BadRequestError('Missing username and/or password and/or email'));

  bcrypt.hash(req.params.password, 8, async (err, hash) => {
    if (err) return res.send(new restify.InternalServerError('Internal server error'));

    const existing = await User.findOne({
      where: {
        $or: [
fork icon0
star icon1
watch icon2

+ 7 other calls in file

252
253
254
255
256
257
258
259
260
261
      next(new restify.NotAuthorizedError('ApiKey is invalid or missing'));
    })
    .catch(function (err) {
      console.log(err);
      Honeybadger.notify(err);
      next(new restify.InternalServerError());
    });
} else {
  next(new restify.NotAuthorizedError('ApiKey is invalid or missing'));
}
fork icon36
star icon0
watch icon0