Reputation: 3680
In hapi.js i can redirect request from 1 route to another using
response.redirect('/home')
How do i send some data with the redirection? I tried setting it in headers
response.redirect('/home').header('x-token', token)
but this data will be lost when it reached another route.
Upvotes: 6
Views: 3074
Reputation: 14590
You could use Yar https://github.com/hapijs/yar
request.yar.set('example', { key: 'value' });
response.redirect('/home')
In home route:
var example = request.yar.get('example'); // this will be "value"
Upvotes: 4