error if neither app nor next
This commit is contained in:
parent
d1b799f142
commit
bca10e90b7
|
@ -26,12 +26,16 @@ module.exports.create = function (le) {
|
||||||
return function (req, res, next) {
|
return function (req, res, next) {
|
||||||
if (0 !== req.url.indexOf(prefix)) {
|
if (0 !== req.url.indexOf(prefix)) {
|
||||||
log(le.debug, "no match, skipping middleware");
|
log(le.debug, "no match, skipping middleware");
|
||||||
if (_app) {
|
if ('function' === typeof _app) {
|
||||||
_app(req, res, next);
|
_app(req, res, next);
|
||||||
}
|
}
|
||||||
else {
|
else if ('function' === typeof next) {
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
res.statusCode = 500;
|
||||||
|
res.end("[500] Developer Error: app.use('/', le.middleware()) or le.middleware(app)");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue