I want to use PostgreSQL on the client side. is it possible? Can I get this code?
in my server.js
var pg = require('pg');
on 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. although I have code like this where I plug in PostgreSQL and use queries on client scripts.
source
share