import { Module } from '@nestjs/common';
import { GraphQLModule } from "@nestjs/graphql"
import { RestaurantsModule } from "./restaurants/restaurants.module"
@Module({
imports: [
RestaurantsModule,
GraphQLModule.forRoot({
autoSchemaFile: true,
}),
],
controllers: [],
providers: [],
})
export class AppModule { }
import { Module } from "@nestjs/common";
import { RestaurantResolver } from "./restaurants.resolver";
@Module({
providers: [RestaurantResolver]
})
export class RestaurantsModule { }
import { Query, Resolver } from "@nestjs/graphql";
import { Restaurant } from "./entities/restaurant.entity"
@Resolver()
export class RestaurantResolver {
@Query(returns => Restaurant)
Restaurant() {
return true;
}
}
import { Field, ObjectType } from "@nestjs/graphql";
@ObjectType()
export class Restaurant {
@Field(type => String)
name: string;
@Field(type => Boolean, { nullable: true })
isGood?: boolean;
}