GithubHelp home page GithubHelp logo

endyjasmi / feathers-pouchdb Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 5.0 429 KB

Feathers PouchDB service.

License: MIT License

JavaScript 100.00%
feathers feathersjs couchdb couchdb-client pouchdb

feathers-pouchdb's Introduction

feathers-pouchdb

Dependency Status Download Status

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:

  • PouchDB - The detailed documentation for this adapter
  • Extending - How to extend a database adapter
  • Pagination and Sorting - How to use pagination and sorting for the database adapter
  • Querying - The common adapter querying mechanism

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);

// Initialize the application
const app = feathers()
  .configure(rest())
  .configure(hooks())
  // Needed for parsing bodies (login)
  .use(bodyParser.json())
  .use(bodyParser.urlencoded({ extended: true }))
  // Initialize your feathers service
  .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.

feathers-pouchdb's People

Contributors

endyjasmi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.