8
I want to use PostgreSQL in the client side. is that possible? can i have this code?
in my server.js
var pg = require('pg');
in my client side
var conString = "postgres://postgres:pass@localhost/mydb";
var client = new pg.Client(conString);
client.connect();
var query = client.query("SELECT * FROM users ");
query.on('row', function(row) {
alert(row.name);
});
i tried this code but nothing happened. though can i have a code similar to this, where i connect PostgreSQL and use queries on the client scripts.