Download next.js/examples/api-routes-apollo-server/shared/query-graphql/index.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 260 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/examples/api-routes-apollo-server/shared/query-graphql/index.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/examples/api-routes-apollo-server/shared/query-graphql/index.ts
-
curl -L -o index.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/examples/api-routes-apollo-server/shared/query-graphql/index.ts
260 Bytes
| import { graphql } from "graphql"; | |
| import { schema } from "../../pages/api/graphql"; | |
| export default async function queryGraphql(query, variableValues = {}) { | |
| const { data } = await graphql({ schema, source: query, variableValues }); | |
| return data || {}; | |
| } | |