Skip to content

Instantly share code, notes, and snippets.

@tylerlee
Last active August 29, 2015 14:23
Show Gist options
  • Save tylerlee/66e1749353f6dd72fd30 to your computer and use it in GitHub Desktop.
Save tylerlee/66e1749353f6dd72fd30 to your computer and use it in GitHub Desktop.
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