I'm attempting to load the Postgres data into node.js and I'm having a lot of difficulty with it. I know the constring works because I used it to send the data from the a textfile into the database.
var request = require('request');
var pg = require('pg');
var squel=require('squel');
var client = new pg.Client(conString);
var conString="postgres://postgres:Password@localhost:5433/postgres"
client.connect(function (err,data){
if(err) console.log("Error connecting to PG", err);
else{
var query = squel.select().from('"ASNTable"')
console.log(query.toString());
client.query(query, function(res){
var outputJSON = [];
for (row in res){
outputJSON.push(row);
}
return outputJSON
console.log(outputJSON)
});
}
});
I keep getting "SELECT * FROM "ASNTable" so its like the client.query part never does anything?