Guest User

Untitled

a guest
Jun 23rd, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. const fs = require('fs');
  2. const {Client} = require('pg')
  3. const id = '887c141e-7c72-4b73-bd8b-d068c74ca071'
  4.  
  5. const client = new Client({
  6. user: 'postgres',
  7. host: 'localhost',
  8. database: 'guttersnipeSimple',
  9. password: 'postgres',
  10. port: 5432,
  11. });
  12.  
  13. const shareableQueryFromFile = {
  14. name: 'fetch-shareable-full',
  15. text: fs.readFileSync(__dirname + '/../../db/sql/ShareableFullQuery.sql', 'utf8'),
  16. values: [id]
  17. }
  18.  
  19.  
  20. client.query(shareableQueryFromFile)
  21. .then(res => console.log('query resukt', res.rows[0]))
  22. .catch(e => console.error(e.stack))
Add Comment
Please, Sign In to add comment