How to use the apollo-server-lambda/dist/lambdaApollo.graphqlLambda function in apollo-server-lambda

To help you get started, we’ve selected a few apollo-server-lambda examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zotoio / serverless-central / packages / sample-graphql / src / handler.ts View on Github external
exports.graphqlHandler = function graphqlHandler(event: any, context: any, callback: any) {
    log.info('hit graphql');

    function callbackFilter(error: any, output: any) {
        // eslint-disable-next-line no-param-reassign
        if (output) {
            output.headers['Access-Control-Allow-Origin'] = '*';
            log.info(output.body);
        } else {
            log.error(error);
        }

        callback(error, output);
    }

    const handler = graphqlLambda({ schema: myGraphQLSchema, tracing: true });
    return handler(event, context, callbackFilter);
};

apollo-server-lambda

Production-ready Node.js GraphQL server for AWS Lambda

MIT
Latest version published 12 months ago

Package Health Score

67 / 100
Full package analysis