{"name":"apollo-server-koa","version":"1.3.3","description":"Production-ready Node.js GraphQL server for Koa","main":"dist/index.js","scripts":{"compile":"tsc","prepublish":"npm run compile"},"repository":{"type":"git","url":"https://github.com/apollographql/apollo-server/tree/master/packages/apollo-server-koa"},"keywords":["GraphQL","Apollo","Koa","Server","Javascript"],"author":{"name":"Jonas Helfer","email":"jonas@helfer.email"},"license":"MIT","bugs":{"url":"https://github.com/apollographql/apollo-server/issues"},"homepage":"https://github.com/apollographql/apollo-server#readme","dependencies":{"apollo-server-core":"^1.3.3","apollo-server-module-graphiql":"^1.3.3"},"devDependencies":{"@types/graphql":"0.12.6","@types/koa":"2.0.44","@types/koa-bodyparser":"4.2.0","@types/koa-router":"7.0.27","apollo-server-integration-testsuite":"^1.3.3","koa":"2.5.0","koa-bodyparser":"4.2.0","koa-router":"7.4.0"},"typings":"dist/index.d.ts","typescript":{"definition":"dist/index.d.ts"},"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","readmeFilename":"README.md","_id":"apollo-server-koa@1.3.3","_shasum":"bf0e9bc3d9de90bb011c55bd1cc095da58591a98","_from":".","_npmVersion":"3.10.10","_nodeVersion":"8.10.0","_npmUser":{"name":"mdg","email":"npm@meteor.com"},"dist":{"shasum":"bf0e9bc3d9de90bb011c55bd1cc095da58591a98","tarball":"http://registry-npm.ywwl.com/apollo-server-koa/download/apollo-server-koa-1.3.3.tgz","fileCount":11,"unpackedSize":12636,"integrity":"sha512-MlFjXuI64qVfARJr9MqX1wzbue5nsypxiqwVmk/+dVtxUAc2LOkHCGyHGAF6E9Rfaq+YpjPTqImanUNz1SMyNA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDGgP1agqhEW8WJ/Uqu6DPECklZKv7OvktEmABo6L5CFwIhAIKrd5RoSHaoINrvw6psnLyzTd5av7uXUqjjDXzRpjAC"}],"size":4135,"noattachment":false,"key":"/apollo-server-koa/-/apollo-server-koa-1.3.3.tgz"},"maintainers":[{"email":"npmjs@jro.cc","name":"abernix"},{"email":"freiksenet@gmail.com","name":"freiksenet"},{"email":"martijn@martijnwalraven.com","name":"martijnwalraven"},{"email":"npm@meteor.com","name":"mdg"},{"email":"s.stubailo@gmail.com","name":"sashko"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/apollo-server-koa_1.3.3_1522074058322_0.26564347604710203"},"_hasShrinkwrap":false,"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.","publish_time":1522074058601,"_cnpm_publish_time":1522074058601,"dist-tags":{"alpha":"3.6.0-alpha.1","alphalambda":"3.0.0-lambda.0","html":"3.0.0-html.2","latest":"3.13.0","next":"3.2.0","next-v3":"3.0.0-alpha.3","preview":"3.0.0-preview.4","rc":"3.0.0-rc.1","unified":"2.23.1-unified2.3","v2":"2.26.2"}}