Created
October 29, 2014 18:50
-
-
Save jedahan/06c7d61c9bc3578aea54 to your computer and use it in GitHub Desktop.
middleware, how do i
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('/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