@ampatspell/ember-cli-sofa

CouchDB persistence library for Ember.js

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
Minified + gzip package size for @ampatspell/ember-cli-sofa in KB

Readme

ember-cli-sofa

This documentation is also available at http://sofa.amateurinmotion.com

Sofa is full featured and easy to use CouchDB persistence addon for Ember.js.

Install

ember install @ampatspell/ember-cli-sofa

Setup

Easiest way to start using sofa, is by extending Store service:

// services/store.js
import { Store } from 'sofa';

const url = 'http://127.0.0.1:5984';

const mapping = {
  main: 'awesome-app',
  users: '_users'
};

export default Store.extend({

  databaseOptionsForIdentifier(identifier) {
    let name = mapping[identifier];
    if(!name) {
      return;
    }
    return { url, name };
  }

});

sofa supports multiple CouchDB hosts and databases (soon also PouchDB). Each database in application is accessed by using identifier. To map identifiers to CouchDB database urls, override databaseOptionsForIdentifier(identifier) and return { url, name } object.

For example, if app queries http://127.0.0.1:5984 /awesome-app and /_users CouchDB databases, you can configure Store by using example above to refer to those using main and users identifiers.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.