Guest User

Untitled

a guest
Feb 25th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. server.route({
  2. path: '/api/companies/{id}',
  3. method: 'GET',
  4. handler(req, reply) {
  5. if (!req.params.id) {
  6. return reply({err: 'id is required param'}).code(400);
  7. }
  8. Company.findById(req.params.id, (err, company) => {
  9. if (err) {
  10. return reply(err).code(404);
  11. }
  12. return reply.response(company);
  13. });
  14. }
  15. });
Add Comment
Please, Sign In to add comment