Dnode client and server for level-userdb.
npm install level-userdb-dnode
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()
npm test
level-userdb-dnode wraps the following API calls from level-userdb.
- findUser()
- addUser()
- checkPassword()
- changeEmail()
- changePassword()
- modifyUser()
- deleteUser()
Wrap leveldb streams to stream larger result sets.
BSD