Advertisement
Guest User

Untitled

a guest
Jul 17th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. const pg = require('pg'),
  2. net = require('net'),
  3. stream = new net.Stream(),
  4. pgConfig = {
  5. user: 'user',
  6. database: 'database',
  7. password: 'password',
  8. port: 5432,
  9. stream: stream
  10. },
  11. connectionTimeout = 3000,
  12. client = new pg.Client(pgConfig);
  13.  
  14. stream.setTimeout(connectionTimeout);
  15. stream.on('timeout', () => {
  16. console.log('Connection timeout');
  17. socket.destroy();
  18. });
  19.  
  20. client.connect();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement