-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
请问怎么在一个api中注入两个不同的service? #10
Comments
构造函数中可以根据需求取出对应的service,取出的同时,awilix会自动实例化对应的service,比如 @route('/todo')
export default class TodoAPI {
constructor({ todoService, otherService }) {
this.todoService = todoService;
this.otherService = otherService; // 注入otherService
}
} |
这个方式试过啦,会报500 @yacan8 ,不知道是不是我命名的问题? 我的service 命名 GameDataService,在构造器中是 gameDataService 这么写吧? |
500的具体报错内容是什么? |
如题:
有些业务场景需要操作两个不同的表,那就会涉及到两个service,看到例子中只能在构造器里注入一个service,那另一个service怎么注入呢
The text was updated successfully, but these errors were encountered: