don't assume api exists
This commit is contained in:
parent
e45264673a
commit
4b083cf7d5
|
@ -236,11 +236,14 @@ function runApi(opts, router, req, res, next) {
|
|||
// TODO compile packagesMap
|
||||
// TODO people may want to use the framework in a non-framework way (i.e. to conceal the module name)
|
||||
router.packages.some(function (_route) {
|
||||
if (!_route.api) {
|
||||
return;
|
||||
}
|
||||
|
||||
var pathname = router.pathname;
|
||||
if ('/' === pathname) {
|
||||
pathname = '';
|
||||
}
|
||||
|
||||
// TODO allow for special apis that do not follow convention (.well_known, webfinger, oauth3.html, etc)
|
||||
if (!_route._api_re) {
|
||||
_route._api_re = new RegExp(escapeStringRegexp(pathname + '/api/' + _route.api.id) + '\/([\\w\\.\\-]+)(\\/|\\?|$)');
|
||||
|
|
Loading…
Reference in New Issue