A simple plugin for testing sessions using Hapi.
npm install --save-dev hapi-session-inject
The hapi-session-inject hapi plugin adds session support to server.inject
.
The hapi-session-inject provides the same interface as server.inject
.
const server = new Hapi.Server();
const session = new Session(server, 'sessioncookiename'); // sessioncookiename defaults to 'session'
// Callback interface
session.inject('/', (res) => {
...
});
// Promise interface
return session.inject('/').then((res) => {
...
});
Additional usage details can be found in test.js