Skip to content

Latest commit

 

History

History
59 lines (49 loc) · 1.11 KB

README.md

File metadata and controls

59 lines (49 loc) · 1.11 KB

HumKin Server

Node/Express.js server for HumKin, Open BloodBank Management System

Make sure Node.js and npm are updated

clone the repo and run

npm install

for development, install supervisor on your system

npm install --global supervisor

run the development server

supervisor index.js

Or run the app

node index.js

Implementation

Update the dbconfig.json

{
    "host": "localhost",
    "user": "root",
    "password": "root",
    "database": "humkin"
}

Connecting to the MySql Database /db.js

var mysql = require('mysql');
var config = require('./dbconfig.json');
var connection;

module.exports = () => {
    if (!connection) {
        connection = mysql.createConnection(config);
        connection.connect(function(err){
            if(!err) {
                console.log('Database is connected!');
            } else {
                console.log('Error connecting database!');
            }
        });
    }
    return connection;
}