Guest User

Untitled

a guest
Jun 25th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. module.exports.getPolls = (req, res) => {
  2.  
  3. let connection;
  4. let polls, pollOptions;
  5.  
  6. sqlConnect().then((conn) => {
  7. connection = conn;
  8. return connection.query('SELECT NANI? FROM poll');
  9. })
  10. .then((results) => {
  11. polls = results[0];
  12. return connection.query('SELECT * FROM poll_option');
  13. })
  14. .then((results) => {
  15. pollOptions = results[0];
  16. console.log(polls);
  17. console.log(pollOptions);
  18. })
  19. .catch((err) => {
  20. throw err;
  21. });
  22.  
  23. }
Add Comment
Please, Sign In to add comment