How to use the NotFoundError function from restify

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

53
54
55
56
57
58
59
60
61
62

employeeService.getPicture(req.user.email, employeeId, pictureType)
    .then(picture => {

        if (!picture || picture === '' || picture === null) {
            res.send(new restify.NotFoundError());
            next();
        } else {
            res.writeHead(200, { 'Content-Type': 'image/jpeg' });
            res.end(picture);
fork icon69
star icon95
watch icon21

21
22
23
24
25
26
27
28
29
  res.send(200, await utils.getAdvUserInfo(req.user));
});

router.get('/user/:name', async (req, res) => {
  const user = await User.findById(req.params.name);
  if (!user) return res.send(new restify.NotFoundError('Invalid user'));

  return res.send(200, await utils.getAdvUserInfo(user));
});
fork icon0
star icon1
watch icon2