Naivete Precedes Misrepresentation
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    inject-thenpublic

    inject-then Build Status NPM version

    Promise wrapper for Hapi's server.inject.

    hapi@12 and above return a promise when no callback is passed to server.inject. Use inject-then for hapi versions less than 12.

    Setup

    $ npm install inject-then
    server.register(require('inject-then'), function (err) {
      if (err) throw err
    })

    API

    server.injectThen(options) -> promise(response)

    server.injectThen('/posts')
      .then(function (response) {
        assert.equal(response.statusCode, 200)
        console.log('Success!')
      })

    Options

    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.

    install

    npm i inject-then

    Downloadslast 7 days

    712

    version

    2.0.9

    license

    MIT

    homepage

    github.com

    repository

    github.com

    last publish

    collaborators

    • avatar