As mentioned in the doc i have to import the middleware... Well is it possible to inject the middleware as follows after registering it to the DI container:
Furthermore even if i import the middleware and pass it to @before, inside the middleware function no dependency is resolved.
middleware.js:
export default function middleware({ tokenService }) {
//tokenService is unedefined by the time @before invokes the middleware (when receiving a request)
//while in my route handler it is resolved as expected
}
How do i deal with middleware which has dependencies if none of the above works as i would expect it ? Is this intended ?
As mentioned in the doc i have to import the middleware... Well is it possible to inject the middleware as follows after registering it to the DI container:
Furthermore even if i import the middleware and pass it to @before, inside the middleware function no dependency is resolved. middleware.js:
How do i deal with middleware which has dependencies if none of the above works as i would expect it ? Is this intended ?