Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function errorHandler(err){
- console.log(err);
- }
- const credentials = {username: 'username', password: 'password'};
- connect(credentials).then(function(connection){
- const query = 'SELECT * FROM posts';
- execute(query, connection).then(function (result){
- close(connection).then(function() {
- response.send(result.rows);
- }).catch(errorHandler);
- }).catch(errorHandler);
- }).catch(errorHandler);
Add Comment
Please, Sign In to add comment