obrandDBWork/connect.js
Martin Donnelly 2b60bc78cf Init
2016-03-15 14:49:39 +00:00

29 lines
524 B
JavaScript

/**
*
* User: Martin Donnelly
* Date: 2016-03-09
* Time: 11:44
*
*/
'use strict';
var pg = require('pg');
var conString = 'postgres://postgres:MPReoa43@localhost/oBrand';
pg.connect(conString, function(err, client, done) {
if(err) {
return console.error('error fetching client from pool',err);
}
client.query('select $1::int as number',[1], function(err,result) {
done();
if (err) {
return console.error('error running query', err);
}
console.log(result.rows[0].number);
})
});