how to use graphql in nestjs micro-service?
how to use graphql in nestjs micro-service?
we all know that graphql could be used with http.
but coult it use by micro-service like nestjs micro-service?
import { NestFactory } from '@nestjs/core';
import { Transport, MicroserviceOptions } from '@nestjs/microservices';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.createMicroservice<MicroserviceOptions>(
AppModule,
{
transport: Transport.TCP,
options: {
port: 23001,
},
},
);
await app.listen();
}
bootstrap();
we all know graphql in nestjs should build resolver, but micro service sould use controller with MessagePattern and EventPattern.
Read more here: Source link
