mirror of https://gitee.com/bigwinds/arangodb
Fix routing order: defaultDocument->router->files
This commit is contained in:
parent
c9be12eb37
commit
a70d0d75cd
|
@ -136,11 +136,6 @@ exports.routeService = function (service, throwOnErrors) {
|
|||
|
||||
service._reset();
|
||||
|
||||
let error = null;
|
||||
if (service.legacy) {
|
||||
error = routeLegacyService(service, throwOnErrors);
|
||||
}
|
||||
|
||||
const defaultDocument = service.manifest.defaultDocument;
|
||||
if (defaultDocument) {
|
||||
service.routes.routes.push({
|
||||
|
@ -156,6 +151,24 @@ exports.routeService = function (service, throwOnErrors) {
|
|||
});
|
||||
}
|
||||
|
||||
let error = null;
|
||||
if (service.legacy) {
|
||||
error = routeLegacyService(service, throwOnErrors);
|
||||
} else {
|
||||
if (service.manifest.main) {
|
||||
try {
|
||||
service.main.exports = service.run(service.manifest.main);
|
||||
} catch (e) {
|
||||
console.errorLines(`Cannot execute Foxx service at ${service.mount}: ${e.stack}`);
|
||||
error = e;
|
||||
if (throwOnErrors) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
service.buildRoutes();
|
||||
}
|
||||
|
||||
if (service.manifest.files) {
|
||||
const files = service.manifest.files;
|
||||
_.each(files, function (file, path) {
|
||||
|
@ -177,22 +190,6 @@ exports.routeService = function (service, throwOnErrors) {
|
|||
});
|
||||
}
|
||||
|
||||
if (!service.legacy) {
|
||||
if (service.manifest.main) {
|
||||
try {
|
||||
service.main.exports = service.run(service.manifest.main);
|
||||
} catch (e) {
|
||||
console.errorLines(`Cannot execute Foxx service at ${service.mount}: ${e.stack}`);
|
||||
error = e;
|
||||
if (throwOnErrors) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
service.buildRoutes();
|
||||
}
|
||||
|
||||
service.main.loaded = true;
|
||||
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue