GithubHelp home page GithubHelp logo

pdxbmw / feathers-couchdb-nano Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 48 KB

A Feathers service adapter for CouchDB using Apache CouchDB Nano driver.

License: MIT License

JavaScript 100.00%
couchdb couchdb-adapter nano feathersjs feathers-service-adapter

feathers-couchdb-nano's Introduction

feathers-couchdb-nano

Build Status Code Climate Test Coverage Dependency Status Download Status

Feathers CouchDB adapter service using Apache CouchDB Nano.

Installation

npm install feathers-couchdb-nano --save

Documentation

Please refer to the Feathers database adapter documentation for more general details.

Options

Name Type Description
connection Object Instance of CouchDB Nano connection.
db String Name of CouchDB database.
events Array List of custom service events sent by this service.
id String Name of id field property (defaults to _id).
name String Name of CouchDB document type (for generating ids and querying).
paginate Object Pagination object containing default and max page size.

Complete Example

Here's an example of a Feathers server that uses feathers-couchdb-nano.

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 plugin = require('feathers-couchdb-nano');
const nano = require('nano');

// Connect to CouchDB
const connection = nano('http://localhost:5984');

// Specify the plugin options
const options = {
  connection: connection,
  db: 'mydb',
  id: 'id',
  name: 'mydoctype',
  paginate: {
    default: 10,
    max: 25
  }
};

// Initialize the application
const app = feathers()
  .configure(rest())
  .configure(hooks())
  // Needed for parsing bodies (login)
  .use(bodyParser.json())
  .use(bodyParser.urlencoded({ extended: true }))
  // Initialize the feathers plugin
  .use('/plugin', plugin(options))
  .use(errorHandler());

app.listen(3030);

console.log('Feathers app started on 127.0.0.1:3030');

Todo

  • Create databases (unless existent)
  • Create and update design documents
  • Integrate couchdb-bootstrap?

License

Copyright (c) 2017

Licensed under the MIT license.

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.