Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. {
  2. method: 'GET',
  3. path: '/api/v1/user/profile/picture',
  4. options: {
  5. auth: {
  6. mode: 'required'
  7. },
  8. handler: function (request, reply) {
  9. if (request.auth.isAuthenticated) {
  10. let user_id = request.auth.credentials._id;
  11. console.log('/api/v1/user/profile/picture/' + user_id);
  12. return reply.redirect('/api/v1/user/profile/picture/' + user_id);
  13.  
  14. } else {
  15. console.log("unauth");
  16. return boom.badRequest(errorCodes.InvalidSession.id);
  17. }
  18.  
  19. }
  20. }
  21. },
  22. {
  23. method: 'GET',
  24. path: '/api/v1/user/profile/picture/{file*}',
  25. options: {
  26. auth: {
  27. mode: 'required'
  28. },
  29. handler: {
  30. directory: {
  31. path: './upload/user/pictures/profile_pic/'
  32. }
  33. }
  34. }
  35.  
  36. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement