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.
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With