mirror of
https://github.com/crystelf/crystelf-core.git
synced 2025-07-04 14:49:19 +00:00
修复public故障
This commit is contained in:
parent
6a8d4f5b9c
commit
0b08a98229
@ -41,12 +41,13 @@ const apps = {
|
|||||||
const filePath = path.join(folderPath, file);
|
const filePath = path.join(folderPath, file);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logger.debug(`尝试加载模块: ${filePath}`);
|
//logger.debug(`尝试加载模块: ${filePath}`);
|
||||||
const controllerModule = require(filePath);
|
const controllerModule = require(filePath);
|
||||||
const controller = controllerModule.default;
|
const controller = controllerModule.default;
|
||||||
|
|
||||||
if (controller?.getRouter) {
|
if (controller?.getRouter) {
|
||||||
const routePath = `/api/${folder}`;
|
const isPublic = folder === 'public';
|
||||||
|
const routePath = isPublic ? `/${folder}` : `/api/${folder}`;
|
||||||
app.use(routePath, controller.getRouter());
|
app.use(routePath, controller.getRouter());
|
||||||
logger.debug(`模块路由挂载: ${routePath.padEnd(12)} => ${file}`);
|
logger.debug(`模块路由挂载: ${routePath.padEnd(12)} => ${file}`);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user