# lambda-graphql

> AWS Lambda graphql handler

Latest version **1.1.0** (published 2017-01-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install lambda-graphql
pnpm add lambda-graphql
yarn add lambda-graphql
bun add lambda-graphql
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2017-01-10 |
| First published | 2017-01-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Maintainers | jakubknejzlik |
| Keywords | lambda, graphql, aws, amazon, middleware, api |

## Links

- npm: https://www.npmjs.com/package/lambda-graphql
- Repository: https://github.com/jakubknejzlik/node-lambda-graphql
- Homepage: https://github.com/jakubknejzlik/node-lambda-graphql#readme
- Issues: https://github.com/jakubknejzlik/node-lambda-graphql/issues
- npm.io page: https://npm.io/package/lambda-graphql

## Dependencies (3)

- [express](https://npm.io/package/express.md) ^4.14.0
- [express-graphql](https://npm.io/package/express-graphql.md) ^0.6.1
- [aws-serverless-express](https://npm.io/package/aws-serverless-express.md) ^1.2.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2017-01-10
- 1.0.0 — 2017-01-09
- 0.1.3 — 2017-01-09
- 0.1.2 — 2017-01-09
- 0.1.1 — 2017-01-09
- 0.1.0 — 2017-01-09

## README

# node-lambda-graphql
AWS Lambda graphql handler

[![Build Status](https://travis-ci.org/jakubknejzlik/node-lambda-graphql.svg?branch=master)](https://travis-ci.org/jakubknejzlik/node-lambda-graphql)

# Installation

```npm install --save lambda-graphql```

# Usage

1) create Lambda function in AWS console

2) install `lambda-graphql` and `graphql` modules

```npm install --save lambda-graphql graphql```

3) create `index.js`...for example:

```
'use strict'

const graphql = require('graphql')
const lambdaGraphql = require('lambda-graphql')

const schema = graphql.buildSchema(`
  type Query {
    hello: String
  }
`)

const root = {
  hello: function(params) {
    return 'world'
  }
}

// options passed to lambdaGraphql() are the same as options for express-graphql module
let app = lambdaGraphql({
  schema: schema,
  rootValue: root
})

// pass handler as `index.handler` for aws lambda
exports.handler = app.handler

// shutdown gracefully (process in container is stopped before going to "sleep")
process.on('exit',() => {
  app.close()
})
process.on('SIGINT',process.exit)
```

3) deploy function by uploading to AWS Lambda

4) setup AWS Gateway API with proxy resource (for example /graphql) and forward requests (`GET` and `POST` methods) to created lambda function

---
_Source: https://npm.io/package/lambda-graphql · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
