Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About Fastify and Nest #3

Open
SirMishaa opened this issue Feb 8, 2021 · 0 comments
Open

About Fastify and Nest #3

SirMishaa opened this issue Feb 8, 2021 · 0 comments

Comments

@SirMishaa
Copy link

Hello !

In advance, thank you for your work. It helped me a lot.

I've a small issue, I'm trying to integrate Nest with Typeorm and Fastify. Here my main.ts :
Method listen doesn't exist on apollo-server-fastify :(

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import {
  FastifyAdapter,
  NestFastifyApplication,
} from '@nestjs/platform-fastify';
import { ValidationPipe } from '@nestjs/common';
import { buildSchema } from 'type-graphql';
import { CatResolver } from './resolver/cat.resolver';
import { ApolloServer } from 'apollo-server-fastify';

async function bootstrap() {
  const app = await NestFactory.create<NestFastifyApplication>(
    AppModule,
    new FastifyAdapter(),
    {
      logger: ['error', 'warn', 'log'],
    },
  );

  const schema = await buildSchema({ resolvers: [CatResolver] });
  const server = await new ApolloServer({ schema });
  app.enableCors();
  app.useGlobalPipes(
    new ValidationPipe({
      disableErrorMessages: false,
    }),
  );
  await app.listen(3000);
}
bootstrap();

image

Do you know how I can make it work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant