NodeJS DB Connection

//—————- SQL Server —————————————-
var mysql = require(‚mysql‘);
var db = mysql.createConnection({
host : ‚localhost‘,
user : ‚dbuser‘,
password : ‚dbpass‘,
database: ‚dbname‘
});

db.connect();

db.query(‚SELECT 1 + 1 AS solution‚, function(err, rows, fields) {
if (err) throw err;
console.log(‚The solution is: ‚, rows[0].solution);
});

process.on(‚exit‘, function (){
db.end();
console.log(‚Goodbye!‘);
});

Schreibe einen Kommentar