Skip to content

Instantly share code, notes, and snippets.

@jedahan
Created October 29, 2014 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jedahan/06c7d61c9bc3578aea54 to your computer and use it in GitHub Desktop.
Save jedahan/06c7d61c9bc3578aea54 to your computer and use it in GitHub Desktop.
middleware, how do i
app.get('/participants', function*() {
var options = {
timestamp: {
$gte: +(this.query.start || 0)
}
};
return this.body = mustache.render(table_template, {
participants: (yield participants.find(options))
});
});
app.get('/participants.json', function*() {
var options = {
timestamp: {
$gte: +(this.query.start || 0)
}
};
return this.body = (yield participants.find(options));
});
app.get('/participants.csv', function*() {
var options = {
timestamp: {
$gte: +(this.query.start || 0)
}
};
return this.body = (yield json2csv({
data: (yield participants.find(options))
}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment