我有两个不同的词典:
Dictionary<int, User> X;
Dictionary<int, User> Y;
Run Code Online (Sandbox Code Playgroud)
我想使用LINQ从它们获取相同键的列表.
我创建了一个auth middlewere来检查每个请求,中间是使用服务器(只有在req.connection中找不到数据).我正在尝试将服务注入到我的中间,我一直得到相同的错误"Nest无法解析AuthenticationMiddleware(?)的依赖关系.请验证当前上下文中是否有[0]参数可用."
AuthenticationModule:
@Module({
imports: [ServerModule],
controllers: [AuthenticationMiddleware],
})
export class AuthenticationModule {
}
Run Code Online (Sandbox Code Playgroud)
AuthenticationMiddleware:
@Middleware()
export class AuthenticationMiddleware implements NestMiddleware {
constructor(private service : UserService) {}
resolve(): (req, res, next) => void {
return (req, res, next) => {
if (req.connection.user)
next();
this.service.getUsersPermissions()
}
}
Run Code Online (Sandbox Code Playgroud)
ServerModule:
@Module({
components: [ServerService],
controllers: [ServerController],
exports: [ServerService]
})
export class ServerModule {}
Run Code Online (Sandbox Code Playgroud)
ApplicationModule:
@Module({
imports: [
CompanyModule,
ServerModule,
AuthenticationModule
]
})
export class ApplicationModule implements NestModule{
configure(consumer: MiddlewaresConsumer): void {
consumer.apply(AuthenticationMiddleware).forRoutes(
{ path: …Run Code Online (Sandbox Code Playgroud)