@webiny/api-plugin-create-apollo-handler
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

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

This Webiny API plugin creates an Apollo handler from the provided schema. It uses the apollo-server-lambda package to create the handler.

How to use

Add the plugin to the plugins section of your service:

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:

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

If you need to change the defaults, see the list of all supported options in the official package docs, and add the handler configuration like this:

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"]

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

    Package Sidebar

    Install

    npm i @webiny/api-plugin-create-apollo-handler

    Weekly Downloads

    10

    Version

    2.0.2

    License

    MIT

    Unpacked Size

    11.4 kB

    Total Files

    6

    Last publish

    Collaborators

    • webiny