Reputation: 2415
I have custom class-based middleware like:
@Service()
export class MyMiddleware implements MiddlewareInterface<Context> {
constructor(private readonly service: Service) {}
async use({ info, context }: ResolverData<Context>, next: NextFn) {
// this.service.doSomeDbLogicHere()
return next();
}
}
@UseMiddleware(MyMiddleware)
@Mutation(() => User)
public async createuser() {}
I wonder how I can pass custom static values to my middleware, but still have other objects injected via DI.
Upvotes: 0
Views: 187
Reputation: 12127
You need to create a function that accepts a static value and return a middleware class.
Upvotes: 1