Hey, when using the example middleware from nestjs:
import { Injectable, NestMiddleware } from '@nestjs/common';
import { Request, Response, NextFunction } from 'express';
@Injectable()
export class LoggerMiddleware implements NestMiddleware {
use(req: Request, res: Response, next: NextFunction) {
console.log('Request...');
next();
}
}
and registering it in the main.ts like this:
app.use(LoggerMiddleware)
I get this error:
Class constructor LoggerMiddleware cannot be invoked without 'new'
I found this github issue https://github.com/nestjs/nest/issues/4467 but well they say use discord your code is wrong, but not what exactly is wrong..