puffer
Puffer is an extendable Couchbase library for Hapi js. It uses Boom to return nicer DB errors and use Q to provide promises.
How to use
You can initialize it in your server and use it in your other files or even other plugins.
Single module with many files
In your server.coffee have something like this:
Hapi = require 'hapi''puffer' host: '127.0.0.1' name: 'default'
Above line will create an instance of couchbase which you can use in your other files as an example in your userModel.coffee you can use this:
bucket = instancebucket
Multiple Hapi Plugins
In your server.coffee have something like this:
Hapi = require 'hapi'db = 'puffer' host: '127.0.0.1' name: 'default' serverregister register: options: bucket: db err -> throw err if err serverstart
Above line will create an instance of couchbase which you should pass to plugins. In your myPlugin module you can do this:
exportsregister = plugin options next -> bucket = optionsbucket bucket
Need More?
- Find the full list of available methods here.
- This documentation is generated by
groc
, you can make a copy of in your local version. - You can run tests locally by
npm test
. Make sure you have development dependencies installed.