hapi-able

0.2.0 • Public • Published

hapi-able

A hapi plugin to add Able A/B testing.

Example

var server = new hapi.Server()

server.register(
  {
    register: require('hapi-able'),
    options: {
      dir: './experiments',
      git: 'git://github.com/dannycoates/able-demo.git#master',
      addRoutes: true,
      watch: true
    }
  },
  function (err) {
    if (err) {
      console.error('plugin error', err)
      process.exit(8)
    }
  }
)

server.route(
  {
    path: '/foo',
    handler: function (request, reply) {
      reply(request.plugins.able.choose('bar'))
    }
  }
)

Registration Options

  • dir : optional directory where experiments are stored. Defaults to ./experiments in the current working directory.
  • git : optional a github url to watch for experiment changes.
  • addRoutes : optional adds routes for using Able from a client browser. Defaults to false.
  • watch : optional poll git for changes to experiments. Defaults to false.

Readme

Keywords

none

Package Sidebar

Install

npm i hapi-able

Weekly Downloads

1

Version

0.2.0

License

MPL 2.0

Last publish

Collaborators

  • dannycoates