{"id":24311528,"url":"https://github.com/skarpdev/hapi-graphql-2","last_synced_at":"2025-06-12T21:12:47.393Z","repository":{"id":57260946,"uuid":"125529937","full_name":"skarpdev/hapi-graphql-2","owner":"skarpdev","description":"Create a GraphQL HTTP server with Hapi v17","archived":false,"fork":false,"pushed_at":"2018-09-11T08:30:01.000Z","size":85,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-18T00:28:47.660Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skarpdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-16T14:48:50.000Z","updated_at":"2021-09-15T07:13:03.000Z","dependencies_parsed_at":"2022-08-31T12:22:28.533Z","dependency_job_id":null,"html_url":"https://github.com/skarpdev/hapi-graphql-2","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skarpdev%2Fhapi-graphql-2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skarpdev%2Fhapi-graphql-2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skarpdev%2Fhapi-graphql-2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skarpdev%2Fhapi-graphql-2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skarpdev","download_url":"https://codeload.github.com/skarpdev/hapi-graphql-2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242619114,"owners_count":20159001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-17T07:11:21.472Z","updated_at":"2025-03-08T22:36:20.841Z","avatar_url":"https://github.com/skarpdev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/skarpdev/hapi-graphql-2.svg?branch=master)](https://travis-ci.org/skarpdev/hapi-graphql-2)\n# GraphQL Hapi Plugin\n\nCreate a GraphQL HTTP server with [Hapi](http://hapijs.com).\nOriginal code from [SimonDegraeves hapi-graphql](https://github.com/SimonDegraeve/hapi-graphql).\n\n```js\nnpm install --save hapi-graphql-2\n```\n\nIf you are using `yarn`\n\n```js\nyarn add hapi-graphql-2\n```\n\n### Example\n\n```js\nconst Hapi = require('hapi');\nconst GraphQL = require('hapi-graphql-2');\nconst {GraphQLSchema} = require('graphql');\n\nconst server = new Hapi.Server({\n  port: 3000\n});\n\nconst TestSchema = new GraphQLSchema({});\n\nawait server.register({\n  plugin: GraphQL,\n  options: {\n    query: {\n      # options, see below\n    },\n    // OR\n    //\n    // query: (request) =\u003e ({\n    //   # options, see below\n    // }),\n    route: {\n      path: '/graphql',\n      config: {}\n    }\n  }\n});\nawait server.start();\nconsole.log('Server running at:', server.info.uri);\n```\n\n### Options\n\nThe `options` key of `query` accepts the following:\n\n  * **`schema`**: A `GraphQLSchema` instance from [`graphql-js`][].\n    A `schema` *must* be provided.\n\n  * **`context`**: A value to pass as the `context` to the `graphql()`\n    function from [`graphql-js`][].\n\n  * **`rootValue`**: A value to pass as the `rootValue` to the `graphql()`\n    function from [`graphql-js`][].\n\n  * **`pretty`**: If `true`, any JSON response will be pretty-printed.\n\n  * **`formatError`**: An optional function which will be used to format any\n    errors produced by fulfilling a GraphQL operation. If no function is\n    provided, GraphQL's default spec-compliant [`formatError`][] function will\n    be used.\n\n  * **`validationRules`**: Optional additional validation rules queries must\n    satisfy in addition to those defined by the GraphQL spec.\n\n  * **`graphiql`**: If `true`, may present [GraphiQL][] when loaded directly\n    from a browser (a useful tool for debugging and exploration).\n\n#### Debugging\n\nDuring development, it's useful to get more information from errors, such as\nstack traces. Providing a function to `formatError` enables this:\n\n```js\nformatError: error =\u003e ({\n  message: error.message,\n  locations: error.locations,\n  stack: error.stack\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskarpdev%2Fhapi-graphql-2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskarpdev%2Fhapi-graphql-2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskarpdev%2Fhapi-graphql-2/lists"}