Guest User

Untitled

a guest
Mar 19th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. server.route({
  2. method: 'GET',
  3. path: '/cookies/set',
  4. config: {
  5. handler: (request: hapi.Request, reply: hapi.IReply) => {
  6. reply('cookie set').state('data', JSON.stringify({
  7. hasCookie: true
  8. }));
  9. }
  10. }
  11. });
  12.  
  13. server.route({
  14. method: 'GET',
  15. path: '/cookies/get',
  16. config: {
  17. state: {
  18. parse: true,
  19. failAction: 'error'
  20. },
  21. handler: (request: hapi.Request, reply: hapi.IReply) => {
  22. reply({
  23. cookie: request.state
  24. })
  25. }
  26. }
  27. });
Add Comment
Please, Sign In to add comment