GraphQL Mesh 를 통해 REST API, GraphQL, gRPC 등등 마이크로서비스 아키텍쳐(MSA) 인프라에서 GraphQL 게이트웨이를 구축 할 수 있습니다.
GraphQL Mesh 튜토리얼 예제를 목표로 하여 개발 합니다.
GET /books
GET /books/:id
GET /categories
GetAuthor
ListAuthors
stores Query
bookSells(storeId: ID!) Query
$ mkdir mesh_gateway
$ cd mesh_gateway
$ yarn add @graphql-mesh/cli graphql
.meshrc.yaml
sources:
- name: Books
handler:
openapi:
endpoint: http://localhost:3002/
- name: Authors
handler:
grpc:
endpoint: http://localhost:3003/
- name: Stores
handler:
graphql:
endpoint: http://localhost:3004/
serve:
hostname: 0.0.0.0
port: 80
endpoint: /
browser: false
playground: true
{
"scripts": {
"start": "mesh start",
"build": "mesh build"
}
}
Books, Authors, Stores API endpoint 를 기본 설정하고 예제를 진행하면서 수정하겠습니다.