Debuggin graphql & mercurius
This commit is contained in:
3640
package-lock.json
generated
3640
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -22,7 +22,13 @@
|
||||
"dependencies": {
|
||||
"@nestjs/common": "^11.0.1",
|
||||
"@nestjs/core": "^11.0.1",
|
||||
"@nestjs/platform-express": "^11.0.1",
|
||||
"@nestjs/graphql": "^13.2.3",
|
||||
"@nestjs/mercurius": "^13.2.3",
|
||||
"@nestjs/platform-fastify": "^11.1.12",
|
||||
"fastify": "^5.7.2",
|
||||
"graphiql": "^5.2.2",
|
||||
"graphql": "^16.12.0",
|
||||
"mercurius": "^16.7.0",
|
||||
"reflect-metadata": "^0.2.2",
|
||||
"rxjs": "^7.8.1"
|
||||
},
|
||||
@@ -32,7 +38,6 @@
|
||||
"@nestjs/cli": "^11.0.0",
|
||||
"@nestjs/schematics": "^11.0.0",
|
||||
"@nestjs/testing": "^11.0.1",
|
||||
"@types/express": "^5.0.0",
|
||||
"@types/jest": "^30.0.0",
|
||||
"@types/node": "^22.10.7",
|
||||
"@types/supertest": "^6.0.2",
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { AppController } from './app.controller';
|
||||
import { AppService } from './app.service';
|
||||
import { GraphQLModule } from '@nestjs/graphql';
|
||||
import { MercuriusDriver, MercuriusDriverConfig } from '@nestjs/mercurius';
|
||||
import { HelloResolver } from './hello.resolver';
|
||||
|
||||
@Module({
|
||||
imports: [],
|
||||
imports: [
|
||||
GraphQLModule.forRoot<MercuriusDriverConfig>({
|
||||
driver: MercuriusDriver,
|
||||
path: '/api/graphql',
|
||||
graphiql: true,
|
||||
autoSchemaFile: true
|
||||
} as MercuriusDriverConfig),
|
||||
],
|
||||
controllers: [AppController],
|
||||
providers: [AppService],
|
||||
providers: [AppService,HelloResolver],
|
||||
|
||||
})
|
||||
export class AppModule {}
|
||||
|
||||
10
src/hello.resolver.ts
Normal file
10
src/hello.resolver.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Resolver, Query } from '@nestjs/graphql';
|
||||
|
||||
@Resolver()
|
||||
export class HelloResolver {
|
||||
|
||||
@Query(() => String)
|
||||
hello(): string {
|
||||
return 'hello world';
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
import { NestFastifyApplication, FastifyAdapter } from '@nestjs/platform-fastify';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
const app = await NestFactory.create<NestFastifyApplication>(AppModule, new FastifyAdapter());
|
||||
await app.listen(process.env.PORT ?? 3000);
|
||||
}
|
||||
bootstrap();
|
||||
|
||||
Reference in New Issue
Block a user