This package has been deprecated

Author message:

renamed to @hoodie/store-server

hoodie-server-store

1.1.0 • Public • Published

THIS IS WORK IN PROGRESS

hoodie-server-store

CouchDB APIs for storing JSON data and sync

Build Status Coverage Status Dependency Status devDependency Status

Install

npm install --save hoodie-server-store

Example

var Hapi = require('hapi')
var hapiStore = require('hoodie-server-store')
 
var server = new Hapi.Server()
 
server.register({
  register: hapiStore,
  options: {
    couchdb: 'http://localhost:5984'
  }
}, function (error) {
  if (error) throw error
})
 
server.connection({
  port: 8000
})
server.start(function () {
  console.log('Server running at %s', server.info.uri)
})

options.couchdb

Url to CouchDB

options: {
  couchdb: 'http://admin:secret@localhost:5984'
}
// or use a node url object
options: {
  couchdb: url.parse('http://admin:secret@localhost:5984')
}

options.PouchDB

PouchDB constructor

options: {
  PouchDB: PouchDB.defaults({
    db: require('memdown')
  })
}

options.hooks

Route lifecycle hooks, see http://hapijs.com/api#request-lifecycle

options: {
  hooks: {
    onPreResponse: onPreResponseHandler,
    onPreAuth: onPreAuthHandler,
    onPostAuth: onPostAuthHandler,
    onPreHandler: onPreHandlerHandler,
    onPostHandler: onPostHandlerHandler,
    onPreResponse: onPreResponseHandler
  }
}

Local setup & tests

git clone git@github.com:hoodiehq/hoodie-server-store.git
cd hoodie-server-store
npm install
npm test

To start the local dev server, run

npm start

License

Apache 2.0

Package Sidebar

Install

npm i hoodie-server-store

Weekly Downloads

1

Version

1.1.0

License

Apache-2.0

Last publish

Collaborators

  • hoodie