NestJS
├─src
│ ├─users
│ │ ├─users.module.ts
│ │ └─users.resolver.ts
│ ├─app.module.ts
│ └─main.ts
├─test
│ └─...test files
└─eslint,env,prettier etc config files
Last active
February 16, 2021 08:53
-
-
Save DillonMemo/b42fe1cac45d7b3fce9877be84f7c34a to your computer and use it in GitHub Desktop.
Apply resolver to NestJS configure practice
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Module } from '@nestjs/common'; | |
import { GraphQLModule } from '@nestjs/graphql'; | |
import { UsersModule } from './users/users.module'; | |
@Module({ | |
imports: [ | |
GraphQLModule.forRoot({ | |
autoSchemaFile: true, // == autoSchemaFile: join(process.cwd(), 'src/schema.gql'), | |
}), | |
UsersModule, | |
], | |
controllers: [], | |
providers: [], | |
}) | |
export class AppModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Module } from '@nestjs/common'; | |
import { UserResolver } from './users.resolver'; | |
@Module({ | |
providers: [UserResolver], | |
}) | |
export class UsersModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Args, Query, Resolver } from '@nestjs/graphql'; | |
@Resolver() | |
export class UserResolver { | |
@Query(() => Boolean) | |
users(@Args('bool') bool: boolean): boolean { | |
return bool; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment