티스토리 뷰
개발자/오류
[GraphQL] GraphQLError [Object]: Query root type must be provided.
YoungDogg 2022. 2. 7. 17:12GraphQLError [Object]: Query root type must be provided.
Resolver.ts에 Query() 하나도 없을 때 나타난다. 추가하자
import { Args, Mutation, Query, Resolver } from '@nestjs/graphql';
import { CreateProductInput } from './dto/createProduct.input';
import { Product } from './entities/product.entity';
import { ProductService } from './product.service';
@Resolver()
export class ProductResolver {
constructor(private readonly productService: ProductService) {}
@Query(() => String)
sayHello(): string {
return 'Hello World!';
}
@Mutation(() => Product)
async createProduct(
@Args('createProductInput') createProductInput: CreateProductInput,
) {
await this.productService.create({ createProductInput }); // 상품 등록
}
}
참고 : Apollo GraphQL Error: Query root type must be provided - Stack Overflow
'개발자 > 오류' 카테고리의 다른 글
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 공부법
- 독커
- nodemon
- js
- 명령어
- error
- 코드캠프
- arrowfunction
- function
- typeorm
- Spread
- Rest
- 백틱
- 에러
- Callback
- 프로그래머스
- 도커
- 코딩습관
- axios
- postman
- 콜백
- yarn
- NPM
- elasticsearch
- 호이스팅
- Console
- GraphQL
- arrow
- Playground
- docker
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
글 보관함