/hapi-session-inject

Hapi server.inject with session support

Primary LanguageJavaScriptMIT LicenseMIT

Hapi-Session-Inject

A simple plugin for testing sessions using Hapi.

Build Status Coverage Status

Install

npm install --save-dev hapi-session-inject

Usage

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