GraphQLロゴGraphQL

graphql-http

公式のgraphql-httpパッケージ(こちら)は、完全に準拠したGraphQLサーバーを作成するための簡単な方法を提供します。Node.jsネイティブのhttpハンドラーに加えて、ExpressFastifyKoaなどのよく知られたフレームワークのハンドラー、そしてDenoBunなどの異なるランタイムのハンドラーも提供します。

Express#

import { createHandler } from "graphql-http/lib/use/express" // ES6
const { createHandler } = require("graphql-http/lib/use/express") // CommonJS

createHandler#

createHandler({
schema: GraphQLSchema,
rootValue?: ?any,
context?: ?any,
formatError?: ?Function,
validationRules?: ?Array<any>,
}): Handler

GraphQLスキーマに基づいてExpressハンドラーを構築します。

使用例については、チュートリアルを参照してください。

他のサーバーフレームワークやランタイムでgraphql-httpを使用する方法など、より詳細なドキュメントについては、GitHub READMEを参照してください。

続きを読む →graphql