{"bugs":{"url":"https://github.com/apollographql/apollo-server/issues"},"dist":{"shasum":"bf0e9bc3d9de90bb011c55bd1cc095da58591a98","tarball":"https://registry.npmjs.org/apollo-server-koa/-/apollo-server-koa-1.3.3.tgz","fileCount":11,"integrity":"sha512-MlFjXuI64qVfARJr9MqX1wzbue5nsypxiqwVmk/+dVtxUAc2LOkHCGyHGAF6E9Rfaq+YpjPTqImanUNz1SMyNA==","signatures":[{"sig":"MEYCIQDGgP1agqhEW8WJ/Uqu6DPECklZKv7OvktEmABo6L5CFwIhAIKrd5RoSHaoINrvw6psnLyzTd5av7uXUqjjDXzRpjAC","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":12636},"main":"dist/index.js","name":"apollo-server-koa","_from":".","author":{"name":"Jonas Helfer","email":"jonas@helfer.email"},"readme":"---\ntitle: Koa\ndescription: Setting up Apollo Server with Koa\n---\n\n[![npm version](https://badge.fury.io/js/apollo-server-core.svg)](https://badge.fury.io/js/apollo-server-core) [![Build Status](https://travis-ci.org/apollographql/apollo-server.svg?branch=master)](https://travis-ci.org/apollographql/apollo-server) [![Coverage Status](https://coveralls.io/repos/github/apollographql/apollo-server/badge.svg?branch=master)](https://coveralls.io/github/apollographql/apollo-server?branch=master) [![Get on Slack](https://img.shields.io/badge/slack-join-orange.svg)](https://www.apollographql.com/#slack)\n\nThis is the Koa integration of Apollo Server. Apollo Server is a community-maintained open-source Apollo Server that works with all Node.js HTTP server frameworks: Express, Connect, Hapi, Koa and Restify. [Read the docs](https://www.apollographql.com/docs/apollo-server/).\n\n```sh\nnpm install apollo-server-koa\n```\n\n## Usage\n\n```js\nimport koa from 'koa'; // koa@2\nimport koaRouter from 'koa-router';\nimport koaBody from 'koa-bodyparser';\nimport { graphqlKoa } from 'apollo-server-koa';\n\nconst app = new koa();\nconst router = new koaRouter();\nconst PORT = 3000;\n\n// koaBody is needed just for POST.\napp.use(koaBody());\n\nrouter.post('/graphql', graphqlKoa({ schema: myGraphQLSchema }));\nrouter.get('/graphql', graphqlKoa({ schema: myGraphQLSchema }));\n\napp.use(router.routes());\napp.use(router.allowedMethods());\napp.listen(PORT);\n```\n\n### GraphiQL\n\nYou can also use `apollo-server-koa` for hosting the [GraphiQL](https://github.com/graphql/graphiql) in-browser IDE. Note the difference between `graphqlKoa` and `graphiqlKoa`.\n\n```js\nimport { graphiqlKoa } from 'apollo-server-koa';\n\n// Setup the /graphiql route to show the GraphiQL UI\nrouter.get(\n  '/graphiql',\n  graphiqlKoa({\n    endpointURL: '/graphql', // a POST endpoint that GraphiQL will make the actual requests to\n  }),\n);\n```\n\nIn case your GraphQL endpoint is protected via authentication, or if you need to pass other custom headers in the request that GraphiQL makes, you can use the [`passHeader`](https://github.com/apollographql/apollo-server/blob/v1.0.2/packages/apollo-server-module-graphiql/src/renderGraphiQL.ts#L17) option – a string that will be added to the request header object.\n\nFor example:\n\n```js\nimport { graphiqlKoa } from 'apollo-server-koa';\n\nrouter.get(\n  '/graphiql',\n  graphiqlKoa({\n    endpointURL: '/graphql',\n    passHeader: `'Authorization': 'Bearer lorem ipsum'`,\n  }),\n);\n```\n\n## Principles\n\nApollo Server is built with the following principles in mind:\n\n* **By the community, for the community**: Apollo Server's development is driven by the needs of developers\n* **Simplicity**: by keeping things simple, Apollo Server is easier to use, easier to contribute to, and more secure\n* **Performance**: Apollo Server is well-tested and production-ready - no modifications needed\n\nAnyone is welcome to contribute to Apollo Server, just read [CONTRIBUTING.md](https://github.com/apollographql/apollo-server/blob/master/CONTRIBUTING.md), take a look at the [roadmap](https://github.com/apollographql/apollo-server/blob/master/ROADMAP.md) and make your first PR!\n","_shasum":"bf0e9bc3d9de90bb011c55bd1cc095da58591a98","license":"MIT","scripts":{"compile":"tsc","prepublish":"npm run compile"},"typings":"dist/index.d.ts","_npmUser":{"name":"mdg","email":"npm@meteor.com"},"homepage":"https://github.com/apollographql/apollo-server#readme","keywords":["GraphQL","Apollo","Koa","Server","Javascript"],"deprecated":"The `apollo-server-koa` package is part of Apollo Server v2 and v3, which are now end-of-life (as of October 22nd 2023 and October 22nd 2024, respectively). This package's functionality is now found in the `@apollo/server` package. See https://www.apollographql.com/docs/apollo-server/previous-versions/ for more details.","repository":{"url":"https://github.com/apollographql/apollo-server/tree/master/packages/apollo-server-koa","type":"git"},"typescript":{"definition":"dist/index.d.ts"},"_npmVersion":"3.10.10","description":"Production-ready Node.js GraphQL server for Koa","directories":{},"maintainers":[{"name":"abernix","email":"npmjs@jro.cc"},{"name":"freiksenet","email":"freiksenet@gmail.com"},{"name":"martijnwalraven","email":"martijn@martijnwalraven.com"},{"name":"mdg","email":"npm@meteor.com"},{"name":"sashko","email":"s.stubailo@gmail.com"}],"_nodeVersion":"8.10.0","dependencies":{"apollo-server-core":"^1.3.3","apollo-server-module-graphiql":"^1.3.3"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"koa":"2.5.0","@types/koa":"2.0.44","koa-router":"7.4.0","@types/graphql":"0.12.6","koa-bodyparser":"4.2.0","@types/koa-router":"7.0.27","@types/koa-bodyparser":"4.2.0","apollo-server-integration-testsuite":"^1.3.3"},"_npmOperationalInternal":{"tmp":"tmp/apollo-server-koa_1.3.3_1522074058322_0.26564347604710203","host":"s3://npm-registry-packages"},"_id":"apollo-server-koa@1.3.3","version":"1.3.3"}