• v3
  • Integrations
  • AWS Lambda

AWS Lambda is a serverless computing platform that makes it easy to build applications that run on the AWS cloud. GraphQL Yoga is platform agnostic so they can fit together easily. In order to reduce the boilerplate we prefer to use Serverless Express from Vendia.

Installation

yarn add graphql
yarn add @vendia/serverless-express
yarn add graphql-yoga

Example

graphql.ts

import type { Handler } from '@aws-cdk/aws-lambda'
import { createYoga } from 'graphql-yoga'
import { configure } from '@vendia/serverless-express'
 
const app = createYoga()
 
export const handler: Handler = configure({
  // Pass Yoga as app
  app,
  // Pass Yoga's logger to listen to the logs from Serverless Express as well
  log: app.logger,
})

You can also check a full example on our GitHub repository here

Last updated on September 20, 2022