Class Middleware with Parameters and DI #1232
-
Sorry for all the posts lately... but I am trying to leverage lots of the greatness in the project. I am using TSyringe for DI and trying to use Middleware to roll my own auth checker, since I have different needs for different resolvers and can only have one instance of an auth checker. The issue, I found another post about wrapping the class with a function that allows input paramters:
This unfortunately does not work since I am not able to register a function, only classes in TSyringe. How would you pass parameters into a class based middleware that can also work with Di? Thanks so much for you thoughts. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You would get only single instance from container, while you need multiple because of the custom parameters you provide ( |
Beta Was this translation helpful? Give feedback.
You would get only single instance from container, while you need multiple because of the custom parameters you provide (
'Hello', 'World'
).