Guest User

Untitled

a guest
Feb 2nd, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. function errorHandler(err){
  2. console.log(err);
  3. }
  4.  
  5. const credentials = {username: 'username', password: 'password'};
  6.  
  7. connect(credentials).then(function(connection){
  8.  
  9. const query = 'SELECT * FROM posts';
  10. execute(query, connection).then(function (result){
  11.  
  12. close(connection).then(function() {
  13. response.send(result.rows);
  14. }).catch(errorHandler);
  15.  
  16. }).catch(errorHandler);
  17.  
  18. }).catch(errorHandler);
Add Comment
Please, Sign In to add comment