spawn-pouchdb-server
v3.3.3
Published
Configurable per-app pouchdb-server as a drop-in replacement for CouchDB
Downloads
56
Readme
spawn-pouchdb-server
Configurable per-app pouchdb-server as a drop-in replacement for CouchDB
Motivation
Simplify development setup
CouchDB is a fantastic database, but setting it up for local development is not easy, as it also requires an Erlang runtime environment. Having a built-in PouchDB-Server in our apps will make CouchDB optional.
Isolated CouchDB configurations
Many Apps require couchdb users / admins / security settings etc. Using PouchDB makes it simple to isolate these in local development. (But if you don't mind the CouchDB dependency, you can also use node-multicouch for that).
Usage
// npm install --save spawn-pouchdb-server
var spawnPouchdbServer = require('spawn-pouchdb-server')
spawnPouchdbServer(function (error, server) {
console.log('PouchDB Server stared at localhost:5985/_utils')
server.stop(function () {
console.log('PouchDB Server stopped')
})
})
Full example with all options (and default values)
// npm install --save spawn-pouchdb-server
var spawnPouchdbServer = require('spawn-pouchdb-server')
spawnPouchdbServer({
port: 5985,
directory: './.db',
backend: {
name: 'leveldown',
location: './.db'
},
log: {
file: './.db/pouch.log',
level: 'info'
},
config: {
file: './.db/config.json'
},
timeout: 10000, // in ms
verbose: false
}, function (error, server) {
console.log('PouchDB Server stared at localhost:5985/_utils')
})
Options
Local setup & tests
git clone [email protected]:gr2m/spawn-pouchdb-server.git
cd spawn-pouchdb-server
npm install
npm test
License
MIT