Skip to content

v2.0.0

Compare
Choose a tag to compare
@hoodiebot hoodiebot released this 15 Oct 05:58

<a name"2.0.0">

2.0.0 (2016-10-15)

Features

Breaking Changes

  • Before, options.db had to be passed to the Api constructor, pre-initialised with "pouchdb-users":
var AccountApi = require("@hoodie/account-server-api")
var PouchDB = require("pouchdb")

PouchDB.plugin(require("pouchdb-users"))

var db = new PouchDB("http://localhost:5984/_users")

db.installUsersBehavior().then(function () {
  var api = new AccountApi({
    db: db,
    secret: "secret123"
  })

  api.accounts.findAll().then(logAccountStats)
  api.accounts.on("change", logAccountChange)
})

Now, options.PouchDB is enough. Optionally options.usersDb for a custom users db name can be passed (it defaults to _users):

var AccountApi = require("@hoodie/account-server-api")
var PouchDB = require("pouchdb")
  .plugin(require("pouchdb-users"))

var api = new AccountApi({
  PouchDB: PouchDB,
  usersDb: "my-users-db",
  secret: "secret123"
})

(e18d4c4c)