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
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;
}