hapi-blister-dependency

2.0.1 • Public • Published

hapi-blister-dependency

Hapi plugin to add the "dependencyId" handler to the server. That handler uses the dependency with the given ID as the handler for the route.

Installation

npm install hapi-blister-dependency

Usage

// CommonJS
// const HapiBlisterDependency = require('hapi-blister-dependency');

// ES6
import HapiBlisterDependency from 'hapi-blister-dependency';
import Blister from 'blister';

const container = new Blister();

container.service('my-handler', () => {
  return (request, h) => {
    h.response('It works!');
  };
});

// Registration
await server.register({
  plugin: HapiBlisterDependency,
  options: { container }
});

server.route({
  path: '/test',
  handler: {
    dependencyId: 'my-handler'
  }
});

// GET /test => It works!

Testing

Clone the repository and execute:

npm test

Contribute

  1. Fork it: git clone https://github.com/softonic/hapi-blister-dependency.git
  2. Create your feature branch: git checkout -b feature/my-new-feature
  3. Commit your changes: git commit -am 'Added some feature'
  4. Check the build: npm run build
  5. Push to the branch: git push origin my-new-feature
  6. Submit a pull request :D

Readme

Keywords

none

Package Sidebar

Install

npm i hapi-blister-dependency

Weekly Downloads

6

Version

2.0.1

License

Apache-2.0

Unpacked Size

12 kB

Total Files

10

Last publish

Collaborators

  • softonic