Socket
Book a DemoInstallSign in
Socket

@lamware/apollo

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lamware/apollo

Lamware Middleware for initializing and memoizing Apollo Server in Lambda

latest
Source
npmnpm
Version
2.0.1
Version published
Maintainers
1
Created
Source
NPM Discord Apache-2.0

Lamware - Apollo Server

This Lamware Middleware utilizes the official apollo-server-lambda package to set-up your Apollo Server outside of the main handler, improving performance.

Installation

This package is available via NPM:

yarn add @lamware/apollo

# or

npm install @lamware/apollo

Usage

import type { APIGatewayProxyHandlerV2 } from 'aws-lambda';
import { ApolloServer } from 'apollo-server-lambda';
import { apollo } from '@lamware/apollo';
import { lamware } from '@lamware/core';

const { handler } = lamware<APIGatewayProxyHandlerV2<any>>()
  // You can pass regular Apollo options.
  .use(apollo({
    introspection: false,
    debug: false,
    schema: ...,
  }))
  // You can also pass an entire Apollo Server instance.
  .use(apollo(new ApolloServer({
    introspection: false,
    debug: false,
    schema: ...,
  })))
  // Or even an (a)synchronous closure!
  .use(apollo(async () => {
    return new ApolloServer({
      introspection: false,
      debug: false,
      schema: ...,
    });
  }))
  .execute(async (payload) => {
    return payload.state.apolloHandler(payload);
  });

export { handler };

Keywords

lambda

FAQs

Package last updated on 21 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts