# @webiny/api-plugin-create-apollo-handler

> Webiny API plugin that creates an Apollo handler.

Latest version **2.0.2** (published 2020-02-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @webiny/api-plugin-create-apollo-handler
pnpm add @webiny/api-plugin-create-apollo-handler
yarn add @webiny/api-plugin-create-apollo-handler
bun add @webiny/api-plugin-create-apollo-handler
```

## Health

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

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2020-02-24 |
| First published | 2019-11-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 11.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8037 |
| Maintainers | webiny |

## Links

- npm: https://www.npmjs.com/package/@webiny/api-plugin-create-apollo-handler
- Repository: https://github.com/webiny/webiny-js
- Homepage: https://github.com/webiny/webiny-js#readme
- Issues: https://github.com/webiny/webiny-js/issues
- npm.io page: https://npm.io/package/@webiny/api-plugin-create-apollo-handler

## Dependencies (2)

- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.5.5
- [apollo-server-lambda](https://npm.io/package/apollo-server-lambda.md) ^2.9.7

## Recent versions

- 2.0.2 (latest) — 2020-02-24
- 2.0.2-next.0 (next) — 2020-02-23
- 2.0.1 — 2020-02-07
- 2.0.1-next.0 — 2020-02-07
- 2.0.0 — 2020-01-27
- 1.1.1-next.2 — 2020-01-27
- 1.1.1-next.1 — 2020-01-27
- 1.1.1-next.0 — 2020-01-24
- 1.1.0 — 2019-11-20
- 1.1.0-next.0 — 2019-11-18

## README

# @webiny/api-plugin-create-apollo-handler

This Webiny API plugin creates an Apollo handler from the provided schema.
It uses the [apollo-server-lambda](https://www.npmjs.com/package/apollo-server-lambda) package to create the handler. 

## How to use
Add the plugin to the `plugins` section of your service:

```yaml
myService:
  component: "@webiny/serverless-apollo-service"
    inputs:
      # ... other inputs ...
      plugins:
        # ... other plugins ...
        - factory: "@webiny/api-plugin-create-apollo-handler"
          options: # Optional
            server: 
              introspection: true
              playground: true 
```

The default CORS configuration is as follows:

```js
{
  origin: "*",
  methods: "GET,HEAD,POST"
}
```

If you need to change the defaults, see the list of all supported options in the [official package docs](https://www.npmjs.com/package/apollo-server-lambda#cors-options), and add the `handler` configuration like this:

```yaml
myService:
  component: "@webiny/serverless-apollo-service"
    inputs:
      # ... other inputs ...
      plugins:
        # ... other plugins ...
        - factory: "@webiny/api-plugin-create-apollo-handler"
          options: # Optional
            server: 
              introspection: true
              playground: true
            handler:
              cors:
                origin: "*"
                methods: ["GET", "HEAD"]
```

---
_Source: https://npm.io/package/@webiny/api-plugin-create-apollo-handler · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
