nestjsnestjs-confignestjs-fastify

Nestjs versioning configuration when using Fastify


For performance reasons of a relatively complex Nestjs application, we have chosen to use Fastify as our HTTP provider.

We are at a stage where we need to version out api and are running into problems after following instructions on the standard Nestjs guide:

  const app = await NestFactory.create<NestFastifyApplication>(
    AppModule,
    new FastifyAdapter(fastifyInstance),
    {},
  );

  app.enableVersioning();

The error received is:

Property 'enableVersioning' does not exist on type 'NestFastifyApplication'.ts(2339)

I haven't been able to find a solution anywhere and thought I'd ask and see if anyone else has had the same problem and found a solution.


Solution

  • looks like you need to upgrade @nestjs/common because enableVersioning does exists in NestFastifyApplication: