跳到正文

Workers GraphQL Server

维护中
cloudflare/workers-graphql-server

运行在 Cloudflare Workers 上的全球分布式 Apollo GraphQL 服务器模板,支持类型化解析器、Service Bindings 和可选的 KV 缓存。

在 GitHub 查看
星标
793
Fork
554
关注
793
未关闭 Issue
3

该介绍目前仅提供英文版本。

Overview

workers-graphql-server is Cloudflare’s template for an Apollo GraphQL server on Cloudflare Workers. Whether your APIs run on-prem, in another cloud or on Cloudflare itself, it puts a globally distributed GraphQL layer in front of them.

Getting started

git clone https://github.com/cloudflare/workers-graphql-server
npm install
npm run dev

Configure wrangler.toml before deploying. The example resolvers call the PokeAPI, so a query like pokemon(id: 1) { name height weight } works right after deployment.

How it’s organized

  • Schema in src/schema.graphql; run npm run codegen after changes to regenerate the types in src/generated/graphql.ts.
  • Resolvers in src/resolvers.ts; they can use Service Bindings to call other Workers.
  • Options such as the base endpoint, the GraphQL sandbox, CORS and KV caching are set in graphQLOptions.

按共同分类和标签排序的同类开源项目。

全部 SDK 项目 →