Can I use PostgreSQL (pg) on ​​the client side (express / node.js)

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.

+5
source share
1 answer

, () . , . , JS , , , , , . PHP Python - AJAX HTTP-.

+5

All Articles