[Support] 怎么获取所有的controllers #4070
Unanswered
zhanzhan0720
asked this question in
Q&A
Replies: 2 comments
-
如果是获取路由,参考 https://midwayjs.org/docs/built_in_service#midwaywebrouterservice |
Beta Was this translation helpful? Give feedback.
0 replies
-
通过 listModule import { CONTROLLER_KEY, listModule } from '@midwayjs/core';
const modules = listModule(CONTROLLER_KEY); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the problem(描述问题)
想获取所有的controllers, 这样获取不到呢
async onReady(container: IMidwayContainer) {
const controllers = await container.getAsync('controllers');
console.log('controllers', controllers);
}
Midway Versions(Midway 版本)
Need to install the following packages:
[email protected]
Beta Was this translation helpful? Give feedback.
All reactions