Reputation: 933
I have a microservice:
import { NestFactory } from '@nestjs/core';
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.createMicroservice<MicroserviceOptions>(
AppModule,
{
transport: Transport.KAFKA,
options: {
client: {
brokers: ['localhost:9092'],
},
consumer: {
groupId: 'auth-consumer',
},
},
},
);
app.listen();
}
bootstrap();
I would like to use GQL Playground but the documentation only refers to default factory (NestFactory.create()
instead of NestFactory.createMicroservice()
). They do app.listen(XXXX)
and just have to navigate to localhost:XXXX/graphql
.
My microservice works with Kafka and is not part of my API gateway, how can I test my GQL endpoints on the GQL Playground ?
Upvotes: 0
Views: 617
Reputation: 1
maybe this will help you!
import { NestFactory } from '@nestjs/core';
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.connectMicroservice<MicroserviceOptions>({
transport: Transport.KAFKA,
options: {
client: {
clientId: 'classroom',
brokers: [process.env.KAFKA_BROKERS as string],
},
consumer: {
groupId: 'purchases',
},
},
});
app.startAllMicroservices().then(() => {
console.log('[MICROSERVICE] is running!');
});
app.listen(process.env.APP_PORT || 3000).then(() => {
console.log('[HTTP/GRAPHQL] is running!');
});
}
bootstrap();
Upvotes: 0