Skip to content

FrozenRidge/level-userdb-dnode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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('[email protected]', 'secret', {some:"data"}, added)
}

// Find user we just added via dnode
function added(err) {
  remote.findUser('[email protected]', 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

Releases

No releases published

Packages

No packages published