I am very much new to the concept of node js. My officers assigned me task to find sharding of database through nodejs. I google and found an npm package, called cluster-pool. How to test it?
var app = express();
var connection = require('express-myconnection');
var mysql = require('mysql');
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use(express.static(path.join(__dirname, 'public')));
app.use(
connection(mysql,{
host: 'localhost',
user: 'root',
password : 'tiger',
port : 3306,
database:'mydb'
},'pool')
);
To connect single database I could use this. How to integrate cluster pool into the code? I tried the sample code used in https://www.npmjs.com/package/cluster-pool . But require('mysql').Client returning undefined. So I cant test it. I installed 'npm install mysql '
I am using:
ejs 1.0.0, express 3.5.1, express-myconnection 1.0.4, jade, mysql 2.2.0, cluster-pool "https://www.npmjs.com/package/cluster-pool "
Is there any valuable tutorial site available for studying nodejs?