Dnode client and server for level-userdb
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

level-userdb-dnode

Build Status

Dnode client and server for level-userdb.

Installation

npm install level-userdb-dnode

Quickstart

var dnodeServer = require('level-userdb-dnode').server
var dnodeClient = require('level-userdb-dnode').client

// Start the server
var server = dnodeServer('my-database')
server.listen(8080)

var client
var remote

// Connect an RPC client
function connect() {
  dnodeClient(8080, addUser)
}

// Add a user via dnode
function addUser(r, c) {
  remote = r
  client = c
  remote.addUser('test@example.com', 'secret', {some:"data"}, added)
}

// Find user we just added via dnode
function added(err) {
  remote.findUser('test@example.com', foundUser)
}

function foundUser(err, user) {
  console.log("user: %s", JSON.stringify(user, null, '\t'))
  process.exit(0)
}

connect()

Tests

npm test

API

level-userdb-dnode wraps the following API calls from level-userdb.

  • findUser()
  • addUser()
  • checkPassword()
  • changeEmail()
  • changePassword()
  • modifyUser()
  • deleteUser()

TODO

Wrap leveldb streams to stream larger result sets.

License

BSD