Guest User

Untitled

a guest
May 24th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. function ConnectToDb() {
  2. var pool = new pg.Pool({
  3. host: "localhost",
  4. port: "5432",
  5. user: "postgres",
  6. password: "111111",
  7. database: "HRS"
  8. });
  9.  
  10. pool.connect(function (err,client,done) {
  11. if(err)console.log("connect " + err.toString());
  12.  
  13. else
  14. client.query('Select* From Info',function (err,result) {
  15.  
  16. if(err) console.log("query "+err.toString());
  17. else console.log(result);
  18. done();
  19. });
  20.  
  21.  
  22. });
  23. pool.end();
  24. }
  25.  
  26. exports.res = ConnectToDb;
Add Comment
Please, Sign In to add comment