error if neither app nor next

This commit is contained in:
AJ ONeal 2016-08-15 18:42:24 -06:00
parent d1b799f142
commit bca10e90b7
1 changed files with 6 additions and 2 deletions

View File

@ -26,12 +26,16 @@ module.exports.create = function (le) {
return function (req, res, next) {
if (0 !== req.url.indexOf(prefix)) {
log(le.debug, "no match, skipping middleware");
if (_app) {
if ('function' === typeof _app) {
_app(req, res, next);
}
else {
else if ('function' === typeof next) {
next();
}
else {
res.statusCode = 500;
res.end("[500] Developer Error: app.use('/', le.middleware()) or le.middleware(app)");
}
return;
}