Giter Club home page Giter Club logo

pouchdb-server's Introduction

pouchdb-server

Build Status

A standalone REST interface server for PouchDB.

Introduction

pouchdb-server is a simple Node.js server that presents a simple REST API, which mimics that of CouchDB, on top of PouchDB. Among other things, this allows users to replicate IndexedDB stores to LevelDB, or to spin up a quick and dirty drop-in replacement for CouchDB to get things moving quickly.

Installation

$ npm install -g pouchdb-server

Usage


Usage: pouchdb-server [options]

Options:
   -p, --port        Port on which to run the server. (Defaults to
                     /_config/httpd/port which defaults to 5984).
   -d, --dir         Where to store database files. (Defaults to
                     /_config/couchdb/database_dir which defaults to the
                     current directory).
   -c, --config      The location of the configuration file that backs
                     /_config. (Defaults to ./config.json).
   -o, --host        The address to bind the server to. (Defaults to
                     /_config/httpd/bind_address which defaults to 127.0.0.1).
   -m, --in-memory   Use a pure in-memory database which will be deleted upon
                     restart. (Defaults to /_config/pouchdb_server/in_memory
                     which defaults to false).
   -r, --proxy       Proxy requests to the specified host. Include a trailing
                     '/'. (Defaults to /_config/pouchdb_server/proxy which
                     defaults to undefined).
   --no-color        Disable coloring of logging output.
   --level-backend   Advanced - Alternate LevelDOWN backend (e.g. memdown,
                     riakdown, redisdown). Note that you'll need to manually
                     npm install it first. (Defaults to
                     /_config/pouchdb_server/level_backend which defaults to
                     undefined).
   --level-prefix    Advanced - Prefix to use for all database names, useful
                     for URLs in alternate backends, e.g.
                     riak://localhost:8087/ for riakdown. (Defaults to
                     /_config/pouchdb_server/level_prefix which defaults to
                     undefined).

Examples:

  pouchdb-server --level-backend riakdown --level-prefix riak://localhost:8087
  Starts up a pouchdb-server that talks to Riak.

  pouchdb-server --level-backend redis
  Starts up a pouchdb-server that talks to Redis, on localhost:6379

  pouchdb-server --level-backend sqldown --level-prefix /tmp/
  Starts up a pouchdb-server that uses SQLite, with db files stored in /tmp/

A simple example might be,

$ pouchdb-server -p 15984
pouchdb-server listening on port 15984.

Alternatively, pouchdb-server's functionality can be mounted into other Express web apps. For more information on that, check out express-pouchdb.

Fauxton

pouchdb-server currently supports an experimental version of CouchDB's Fauxton. Fauxton, the successor to CouchDB's original Futon, is a simple web UI for interacting with your databases. With your server running, navigate to /_utils to check it out!

Testing

One of the primary benefits of pouchdb-server is the ability to run PouchDB's Node test suite against itself. To do that, you can simply,

$ npm run test-pouchdb

Whatever args you provide as SERVER_ARGS will be passed to pouchdb-server itself:

$ SERVER_ARGS='--in-memory' npm run test-pouchdb

Or to test in Firefox (IndexedDB):

$ CLIENT=selenium:firefox npm run test-pouchdb

Or to test in PhantomJS (WebSQL):

$ CLIENT=selenium:phantomjs ES5_SHIM=true npm run test-pouchdb

Additionally, we've started porting CouchDB's JavaScript test harness to a simple Node module, which can be run against PouchDB via pouchdb-server.

$ npm run test-couchdb

Contributing

Want to help me make this thing awesome? Great! Here's how you should get started.

  1. First, make sure that the bugfix or feature you're looking to implement isn't better fit for express-pouchdb.
  2. PouchDB is still developing rapidly. If you need bleeding egde versions, you should first read how to set up express-pouchdb for local development. (Make sure that, afterwards, you npm link express-pouchdb).
  3. Go ahead and fork pouchdb-server, clone it to your machine.
  4. Now you'll want to, from the root of pouchdb-server, npm link express-pouchdb.
  5. npm install the rest of the dependencies.

Please make your changes on a separate branch whose name reflects your changes, push them to your fork, and open a pull request!

For commit message style guidelines, please refer to PouchDB CONTRIBUTING.md.

Contributors

These people made pouchdb-server into what it is today!

License

The MIT License. See the LICENSE file for more information.

pouchdb-server's People

Contributors

nick-thompson avatar nolanlawson avatar marten-de-vries avatar dougwilson avatar garrensmith avatar peterdavehello avatar ryanramage avatar grncdr avatar tahmmee avatar copongcopong avatar tttp avatar

Watchers

 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.