inject-then

Promise wrapper for Hapi's server.inject

inject-then

Promise wrapper for Hapi's server.inject.

$ npm install inject-then
server.register(require('inject-then'), function (err) {
  if (err) throw err;
});
server.injectThen('/posts')
  .then(function (response) {
    assert.equal(response.statusCode, 200);
    console.log('Success!');
  });

The following options can be provided at registration:

  • Promise: An optional Promise constructor (ES6 Promise or anything that can be called with new Promise). Bluebird is used if an override is not provided.