Advertisement
Guest User

updatedCode

a guest
Jan 30th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. 'use strict';
  2.  
  3. const { Pool, Client } = require('pg');
  4. const client = new Client({
  5. user: 'postgres',
  6. host: '10.0.0.62',
  7. database: '<REDACTED>',
  8. password: '<REDACTED>',
  9. port: 5432,
  10. ssl: true
  11. });
  12. client.connect();
  13.  
  14. client.query('SELECT NOW()', (err, res) => {
  15. console.log(err, res)
  16. client.end()
  17.  
  18. const response = {
  19. statusCode: 200,
  20. body: JSON.stringify({
  21. message: res,
  22. input: event,
  23. }),
  24. };
  25. //callback(null, response);
  26. });
  27.  
  28. // Use this code if you don't use the http event with the LAMBDA-PROXY integration
  29. // callback(null, { message: 'Go Serverless v1.0! Your function executed successfully!', event });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement