Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var pgp = require('pg-promise')(/*options*/);
- var cn = {
- host: 'localhost', // server name or IP address;
- port: 5432,
- database: 'trading_database_eur_usd',
- user: 'postgres',
- password: '7256'
- };
- // alternative:
- // var cn = 'postgres://username:password@host:port/database';
- var db = pgp(cn); // database instance;
- // select and return user name from id:
- db.one('SELECT * FROM eur_usd WHERE OPEN_PRICE > 1.12918;')
- .then(user => {
- console.log(user.name); // print user name;
- })
- .catch(error => {
- console.log(error); // print the error;
- });
Add Comment
Please, Sign In to add comment