Skip to content

ekazukii/simpleusermanager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimpleUserManager

Simpleusermanager is a nodejs module for manage user with a mysql database

Geting started

simply install simpleusermanager with npm like this npm install --save simpleusermanager

Once installed you can use it by calling require(simpleusermanager)

Dependencies

This project require mysql

Example

Simple login system using express, mysql and simpleusermanager

var manager = require(simpleusermanager)
const express = require('express');
var mysql = require('mysql');

var con = mysql.createConnection({
  // Setup your mysql object
});

const app = express();
app.post('/login',function(req,res){
    var username = req.body.username, password = req.body.password
    usermanager.login(con, username, password, function(err, data) {
        if (err) throw err;
        console.log(data.id);
    });
});