Newton's Programmatic Measurements
Miss any of our Open RFC calls?Watch the recordings here! »

@nearform/trail-hapi-plugin

4.0.0 • Public • Published

@nearform/trail-hapi-plugin

npm

trail-hapi-plugin is a plugin to add the trail REST API to a Hapi server.

Install

To install via npm:

npm install @nearform/trail-hapi-plugin

Usage

const main = async function() {
  const server = require('hapi').Server({host: 'localhost', port: 80})
 
  await server.register([
    {
      plugin: require('@nearform/trail-hapi-plugin'),
    }
  ])
 
  await server.start()
  logMessage(`Server running at: ${server.info.uri}`)
}
 
main().catch(console.error)

Trails route will be then accessible on the /trails path.

For more information on the REST API, you can check the generated OpenAPI / Swagger JSON file, which will available at the /trails/swagger.json path.

Configuration

The plugin takes the following configuration options:

  • logger: A logger to be passed to the trails manager.
  • db: Database settings for the trails manager.
  • pool: A pre-configured database pool to be used by the trails manager; used in preference to any specified database settings.
  • trailsManager: A pre-configured trails manager instance; used in preference to any of the previous settings.

License

Copyright nearForm Ltd 2018. Licensed under MIT.

Install

npm i @nearform/trail-hapi-plugin

DownloadsWeekly Downloads

4

Version

4.0.0

License

MIT

Unpacked Size

40.6 kB

Total Files

15

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar