-1

I am trying to connect my NuxtJS app (@nuxtjs/apollo) with my NestJS app (@nestjs/graphql), which should work only as a GraphQL server.

I can not figure out the apollo entry point.

I get always a 404, which is right because I do not know how.

Here is my nuxt config.

apollo: {
  clientConfigs: {
    default: {
      httpEndpoint: 'http://localhost:4000',
      browserHttpEndpoint: '/graphql'
    }
  }
}

Here is my nest config

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  await app.listen(4000);
}
bootstrap();

Here is my AppModule class

import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { PagesModule } from './pages/pages.module';

@Module({
  imports: [

    PagesModule,
    GraphQLModule.forRoot({
      typePaths: ['./**/*.graphql'],
    }),
  ],
})
export class AppModule {}

I appreciate any help on this matter!!!

Toni PRI
  • 11
  • 4

1 Answers1

0

app.module.ts

GraphQLModule.forRoot({
      autoSchemaFile: join(process.cwd(), 'src/schema.gql'),
      path: `/api/ticket/graphql`, // <-
    })

nuxt.config.js:

{
apollo: {
    clientConfigs: {
      default: {
        httpEndpoint: `http://localhost:4000/api/ticket/graphql`, // <-
      },
    },
  }
}