fix: 优化connect ws的模块
This commit is contained in:
@@ -138,11 +138,18 @@ export const initLightCode = async (opts: opts) => {
|
||||
continue;
|
||||
}
|
||||
// console.log(`注册 light-code 路由: [${routerItem.path}] ${routerItem.id} 来自文件: ${file.filepath}`);
|
||||
const metadata = routerItem.metadata || {};
|
||||
if (metadata.tags && Array.isArray(metadata.tags)) {
|
||||
metadata.tags.push('light-code');
|
||||
} else {
|
||||
metadata.tags = ['light-code'];
|
||||
}
|
||||
app.route({
|
||||
id: routerItem.id,
|
||||
path: routerItem.id!,
|
||||
path: `${routerItem.id}__${routerItem.path}`,
|
||||
key: routerItem.key,
|
||||
description: routerItem.description || '',
|
||||
metadata: routerItem.metadata || {},
|
||||
metadata,
|
||||
middleware: ['auth'],
|
||||
}).define(async (ctx) => {
|
||||
const tokenUser = ctx.state?.tokenUser || {};
|
||||
|
||||
Reference in New Issue
Block a user