Guest User

Untitled

a guest
Feb 17th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. mount: function(req) {
  2. return {
  3. title: req.param('title'),
  4. image: req.param('image'),
  5. thumbnail: req.param('thumbnail'),
  6. body: req.param('body'),
  7. tags: req.param('tags'),
  8. author: req.param('author_id'),
  9. status: req.param('status')
  10. }
  11. },
  12.  
  13. create: function(req, res) {
  14. var article = this.mount(req);
  15.  
  16. if (!article) {
  17. return false;
  18. }
  19.  
  20. Article.create(article).exec(function(err, article) {
  21. if (err) {
  22. res.send(500, {
  23. status: 'error',
  24. error: err
  25. });
  26. }
  27. res.send(article);
  28. });
  29. }
Add Comment
Please, Sign In to add comment