Advertisement
MrZep

Untitled

Mar 11th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .get((req ,res) => {
  2.         if (req.params.include && req.params.include) {
  3.             db.models.model[req.params.model].findById(req.params.id, {include:req.params.include})
  4.                 .then((data) => {
  5.                     res.json(data);
  6.                 }).catch((err) => {
  7.                     res.status(500).end();
  8.                     console.log(err);
  9.             });
  10.         } else {
  11.             db.models.model[req.params.model].findById(req.params.id,)
  12.                 .then((data) => {
  13.                     res.json(data);
  14.                 }).catch((err) => {
  15.                     res.status(500).end();
  16.                     console.log(err);
  17.             });
  18.         }
  19.  
  20.     })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement