Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

larvituser

Package Overview
Dependencies
Maintainers
1
Versions
261
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

larvituser

User module for node.js

  • 0.4.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
332
increased by25.28%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

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 UUID: ' + user.uuid);
});

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

userLib.fromUserAndPass('myUsername', 'myPassword', function(err, user) {
    if (err) {
        throw err;
    }

    if ( ! user) {
        // 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!

The default config file will be application path/config/db_test.json

Or a custom one can be used by running

mocha test/test.js /path/to/config/db_another.json

Keywords

FAQs

Package last updated on 15 Nov 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc