v2.0.0
<a name"2.0.0">
2.0.0 (2016-10-15)
Features
- options.PouchDB (e18d4c4c)
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)