First commit

This commit is contained in:
Arjun Patel
2018-12-30 13:51:40 -08:00
parent 07f14b4234
commit 1e6ea4c22c
4 changed files with 551 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
database : 'dbname',
user : 'username',
password : 'password',
});
connection.connect(function(err) {
if (err) {
console.error('Error connecting: ' + err.stack);
return;
}
console.log('Connected as id ' + connection.threadId);
});
connection.query('SELECT * FROM employee', function (error, results, fields) {
if (error)
throw error;
results.forEach(result => {
console.log(result);
});
});
connection.end();