jeremyscalpello/express-nobots

not working with fastify adapter in nestjs

rajkumarpb opened this issue · 0 comments

Implemented express-nobots with nestjs application and it worked fine.

import * as noBots from 'express-nobots';

async function bootstrap() {
    const app = await NestFactory.create(AppModule);
    app.use(noBots());
  await Promise.all([ 3939)]);
}

bootstrap();

If i try to use FastifyAdapter in NestJs, I'm getting below error.

async function bootstrap() {
  const app = await NestFactory.create<NestFastifyApplication>(
    AppModule,
    new FastifyAdapter(),
  );
app.use(noBots());
  await Promise.all([ 3939)]);
}

bootstrap();

Error is:

node_modules/express-nobots/lib/middleware.js:15
    var ua = req.get('User-Agent');
                 ^

TypeError: req.get is not a function