@piemme/authentication-service

1.0.1 • Public • Published

#authenticationService

A node.js module for NodeJS Avanscoperta Course. authenticationService offers authentication API

npm install @piemme/authentication-service

Usage

var auth = require('@piemme/authentication-service')([connectionString]);
auth.put({
	username: "exetera",
	password: "pippo"
}, function (err, result) {
      console.log(result)
      });

Methods

put

A method to insert an user in a Mongo database.

var user = {
		username: "exetera12323",
		password: "pippo"
	}

	auth.put(user, function callback (err, result){
		 console.log(result)
	});

get

A method to get an existing user from a Mongo database.

	var user = {
		username: "exetera2",
		password: "pippo"
    };

    auth.get(user, function(err, result){
        console.log(result)

    });

close

A method to close the connection to Mongo database.

	function(){
		db.close();
	}

Dependencies

Joi for validation
mongojs for database connection
tape for testing

Readme

Keywords

Package Sidebar

Install

npm i @piemme/authentication-service

Weekly Downloads

2

Version

1.0.1

License

ISC

Last publish

Collaborators

  • piemme