New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

larvituser

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

larvituser

User module for node.js


Version published
Maintainers
1
Created

larvituser

User module for node.js

Usage

First fire up the library connections like this:

var userLib = require('larvituser');

Create a new user in the database, do like this:

var userData = {
	'firstname': 'Nisse',
	'lastname': 'Nilsson',
	'role': [
		'user',
		'subscriber'
	]
}

userLib.create('myUsername', 'myPassword', userData, function(err, user) {
	console.log('New user ID: ' + user.id);
});

To fetch a user from database based on username and password, do like this:

userLib.fromUserAndPass('myUsername', 'myPassword', function(err, user) {
	if (err) {
		// No match found, or other more serious error
	} else {
		console.log('Fetched user ID: ' + user.id);
	}
});

Tests

Run tests with mocha, make sure to have an empty database configured for tests to pass correctly!

Keywords

FAQs

Package last updated on 08 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts