Skip to content

Instantly share code, notes, and snippets.

@mctep
Last active August 29, 2015 14:10
Show Gist options
  • Save mctep/28f39f0d239fca657287 to your computer and use it in GitHub Desktop.
Save mctep/28f39f0d239fca657287 to your computer and use it in GitHub Desktop.
app.get('/', function(req, res, next) {
if (typeof req.body.foo !== 'boolean') {
return next (new TypeError());
}
next()
}, function(req, res, next) {
mysql.query('select 1', function(err, result) {
if (err) { return next(err); }
res.send(result);
})
});
router.get('/')
.body({ foo: Boolean })
.use(function() {
return this.source('mysql').query('select 1');
})
.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment