Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports.getPolls = (req, res) => {
- let connection;
- let polls, pollOptions;
- sqlConnect().then((conn) => {
- connection = conn;
- return connection.query('SELECT NANI? FROM poll');
- })
- .then((results) => {
- polls = results[0];
- return connection.query('SELECT * FROM poll_option');
- })
- .then((results) => {
- pollOptions = results[0];
- console.log(polls);
- console.log(pollOptions);
- })
- .catch((err) => {
- throw err;
- });
- }
Add Comment
Please, Sign In to add comment