Last active
August 29, 2015 14:23
-
-
Save tylerlee/66e1749353f6dd72fd30 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get('/results', function (request, response) { | |
var instagrams = []; | |
var tweets = []; | |
pg.connect(process.env.DATABASE_URL, function (err, client, done) { | |
client.query('SELECT * FROM tweets ORDER BY created_at DESC', function (err2, result) { | |
if (err2) { | |
console.error(err); response.send('Error ' + err2); | |
} else { | |
tweets = result.rows; | |
} | |
}); | |
client.query('SELECT * FROM instagrams ORDER BY created_at DESC', function (err2, result) { | |
if (err2) { | |
console.error(err); response.send('Error ' + err2); | |
} else { | |
instagrams = result.rows; | |
} | |
}); | |
done(); | |
}); | |
var feed = [instagrams, tweets]; | |
response.send(feed); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment