Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. // articles.service.js
  2. module.exports = {
  3. name: "articles",
  4.  
  5. actions: {
  6. list: {
  7. handler(ctx) {
  8. return "GET articles list";
  9. }
  10. },
  11.  
  12. get: {
  13. handler(ctx) {
  14. return `GET the Article with Id = ${ctx.params.id}`;
  15. }
  16. },
  17.  
  18. create: {
  19. params: {
  20. title: { type: "string" }
  21. },
  22. handler(ctx) {
  23. return `CREATE Article with title = ${ctx.params.title}`;
  24. }
  25. },
  26.  
  27. update: {
  28. params: {
  29. title: { type: "string" }
  30. },
  31. handler(ctx) {
  32. return `UPDATE title of Article with Id = ${
  33. ctx.params.id
  34. }. New title: ${ctx.params.title}`;
  35. }
  36. },
  37.  
  38. remove: {
  39. handler(ctx) {
  40. return `DELETE Article with Id = ${ctx.params.id}`;
  41. }
  42. }
  43. }
  44. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement