# pb-apollo-server-koa

> Production-ready Node.js GraphQL server for Koa

Latest version **2.5.2** (published 2019-05-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install pb-apollo-server-koa
pnpm add pb-apollo-server-koa
yarn add pb-apollo-server-koa
bun add pb-apollo-server-koa
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.5.2 |
| Published | 2019-05-20 |
| First published | 2019-05-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 16 |
| Unpacked size | 56.5 KB |
| Known vulnerabilities | 0 (+5 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | opensource@apollographql.com |
| Maintainers | brendanwheble |
| Keywords | GraphQL, Apollo, Server, Koa, Javascript |

## Links

- npm: https://www.npmjs.com/package/pb-apollo-server-koa
- Repository: https://github.com/brendanwheble/apollo-server/tree/master/packages/apollo-server-koa
- Homepage: https://github.com/apollographql/apollo-server#readme
- Issues: https://github.com/apollographql/apollo-server/issues
- npm.io page: https://npm.io/package/pb-apollo-server-koa

## Dependencies (16)

- [koa](https://npm.io/package/koa.md) 2.7.0
- [accepts](https://npm.io/package/accepts.md) ^1.3.5
- [type-is](https://npm.io/package/type-is.md) ^1.6.16
- [@koa/cors](https://npm.io/package/@koa/cors.md) ^2.2.1
- [@types/koa](https://npm.io/package/@types/koa.md) ^2.0.46
- [koa-router](https://npm.io/package/koa-router.md) ^7.4.0
- [@types/cors](https://npm.io/package/@types/cors.md) ^2.8.4
- [graphql-tools](https://npm.io/package/graphql-tools.md) ^4.0.0
- [@types/accepts](https://npm.io/package/@types/accepts.md) ^1.3.5
- [koa-bodyparser](https://npm.io/package/koa-bodyparser.md) ^3.0.0
- [@types/koa__cors](https://npm.io/package/@types/koa__cors.md) ^2.2.1
- [@types/koa-compose](https://npm.io/package/@types/koa-compose.md) ^3.2.2
- [apollo-server-core](https://npm.io/package/apollo-server-core.md) file:../apollo-server-core
- [@types/koa-bodyparser](https://npm.io/package/@types/koa-bodyparser.md) ^4.2.1
- [graphql-subscriptions](https://npm.io/package/graphql-subscriptions.md) ^1.0.0
- [@apollographql/graphql-playground-html](https://npm.io/package/@apollographql/graphql-playground-html.md) ^1.6.6

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 2.5.2 (latest) — 2019-05-20

## README

---
title: Koa
description: Setting up Apollo Server with Koa
---

[![npm version](https://badge.fury.io/js/apollo-server-koa.svg)](https://badge.fury.io/js/apollo-server-koa) [![Build Status](https://circleci.com/gh/apollographql/apollo-server.svg?style=svg)](https://circleci.com/gh/apollographql/apollo-server) [![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/apollo)


This is the Koa integration of GraphQL Server. Apollo Server is a community-maintained open-source GraphQL server that works with many Node.js HTTP server frameworks. [Read the docs](https://www.apollographql.com/docs/apollo-server/). [Read the CHANGELOG.](https://github.com/apollographql/apollo-server/blob/master/CHANGELOG.md)

```sh
npm install apollo-server-koa graphql
```

## Koa

```js
const Koa = require('koa');
const { ApolloServer, gql } = require('apollo-server-koa');

// Construct a schema, using GraphQL schema language
const typeDefs = gql`
  type Query {
    hello: String
  }
`;

// Provide resolver functions for your schema fields
const resolvers = {
  Query: {
    hello: () => 'Hello world!',
  },
};

const server = new ApolloServer({ typeDefs, resolvers });

const app = new Koa();
server.applyMiddleware({ app });

app.listen({ port: 4000 }, () =>
  console.log(`🚀 Server ready at http://localhost:4000${server.graphqlPath}`),
);
```

## Principles

GraphQL Server is built with the following principles in mind:

- **By the community, for the community**: GraphQL Server's development is driven by the needs of developers
- **Simplicity**: by keeping things simple, GraphQL Server is easier to use, easier to contribute to, and more secure
- **Performance**: GraphQL Server is well-tested and production-ready - no modifications needed

Anyone is welcome to contribute to GraphQL 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!

---
_Source: https://npm.io/package/pb-apollo-server-koa · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
