Socket
Socket
Sign inDemoInstall

puffer

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

puffer

Extendable Couchbase ODM for Hapi js


Version published
Weekly downloads
3
increased by50%
Maintainers
2
Weekly downloads
 
Created
Source

puffer

Build Status npm version Coverage Status

Puffer is an extendable Couchbase library for Hapi js. It uses Boom to return nicer DB errors and use Q to provide promises.

  • Full documation can be found here.
  • Source code is available at here.

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'
new require('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 = require('puffer').instance
bucket.insert( 'doc1', { color: 'red' } )
      .then( (d) -> console.log d )

Multiple Hapi Plugins

In your server.coffee have something like this:

Hapi = require 'hapi'
db = new require('puffer')( { host: '127.0.0.1', name: 'default' } )

server.register { 
  register: require('myPlugin'), 
  options: { bucket: db } 
}, (err) ->
  throw err if err
  server.start()

Above line will create an instance of couchbase which you should pass to plugins. In your myPlugin module you can do this:

exports.register = (plugin, options, next) ->
  bucket = options.bucket
  bucket.insert( 'doc1', { color: 'red' } )
        .then( (d) -> console.log d )

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.

FAQs

Package last updated on 07 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc