Modified server to test db connection
This commit is contained in:
parent
01a6353f69
commit
a821e88fc6
13
server.js
13
server.js
|
@ -1,6 +1,10 @@
|
|||
var http = require('http');
|
||||
var express = require('express');
|
||||
var jade = require('jade');
|
||||
var pg = require('pg');
|
||||
|
||||
// pg conf
|
||||
var pgc = require('./private');
|
||||
|
||||
var app = express();
|
||||
var urls = require('./urls');
|
||||
|
@ -51,3 +55,12 @@ if ( app.get('env') === 'development' ) {
|
|||
|
||||
console.log("Starting server on " + server_ip_address + ":" + server_port);
|
||||
app.listen(server_port, server_ip_address);
|
||||
|
||||
console.log("Trying to connect to the db...");
|
||||
pg.connect(pgc.url, function(err, client, done) {
|
||||
if (err) {
|
||||
return console.error('error fetching client from pool', err);
|
||||
}
|
||||
|
||||
client.query('INSERT INTO Users(name) VALUES(\'Hello\')');
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue