feathers-pouchdb

Create a PouchDB service for FeatherJS.
Installation
npm install pouchdb-core pouchdb-find pouchdb-adapter-leveldb feathers-pouchdb --save
Documentation
Please refer to the Feathers database adapter documentation for more details or directly at:
Limitation
- Currently this plugin DOES NOT fully support pagination because of the way CouchDB Mango Query is designed to make use map reduce index. The skip and limit does work though, just not the total attribute though.
Complete Example
Here's an example of a Feathers server that uses feathers-pouchdb
.
const PouchDBCore = require('pouchdb-core');
const PouchDBFind = require('pouchdb-find');
const PouchDBLevelDBAdapter = require('pouchdb-adapter-leveldb');
const feathers = require('feathers');
const rest = require('feathers-rest');
const hooks = require('feathers-hooks');
const bodyParser = require('body-parser');
const errorHandler = require('feathers-errors/handler');
const service = require('feathers-pouchdb');
const PouchDB = PouchDBCore.plugin(PouchDBLevelDBAdapter)
.plugin(PouchDBFind);
const app = feathers()
.configure(rest())
.configure(hooks())
.use(bodyParser.json())
.use(bodyParser.urlencoded({ extended: true }))
.use('/messages', service({ Model: new PouchDB('./messages') }))
.use(errorHandler());
app.listen(3030);
console.log('Feathers app started on 127.0.0.1:3030');
You can run this example and going to localhost:3030/messages. You should see an empty array. That's because you don't have any Todos yet but you now have full CRUD for your new messages service.
License
Copyright (c) 2017
Licensed under the MIT license.