Currently, the decorators exported via the inversify-express-utils package throw an error similar to the following:

The TypeScript compiler throws the error:
error TS1241: Unable to resolve signature of method decorator when called as an expression.
Use of the decorators from the package should not throw an error when applied to a controller class method.
httpGet, httpPost etc. decorator to a controller class method@Josh-ES
The @httpPut function is looking for an express.RequestHandler as its second input. This is used as express middleware.
the type signature of express.RequestHandler is
(req: Request, res: Response, next: NextFunction): any;
the value that you are passing is not a function it is the return value of passport.authenticate
the way that I handle this is to have a separate middleware function
function authenticationMiddleware(req: Request, res: Response, next: NextFunction) {
passport.authenticate(....);
}
@httpPost("/", authenticationMiddleware)
...
Most helpful comment
@Josh-ES
The
@httpPutfunction is looking for anexpress.RequestHandleras its second input. This is used as express middleware.the type signature of
express.RequestHandleris(req: Request, res: Response, next: NextFunction): any;the value that you are passing is not a function it is the return value of
passport.authenticatethe way that I handle this is to have a separate middleware function