PatrickJS / apollo-engine-js

Apollo Engine middleware for Node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Apollo Engine

npm version Build Status

This package integrates the Apollo Engine proxy with your GraphQL server.

When installed, it starts the Apollo Engine proxy in a new process, then routes GraphQL requests through that proxy:

Sequence Diagram

Usage

import { Engine } from 'apollo-engine';

// create new engine instance from JS config object
const engine = new Engine({ engineConfig: { ... } });

// create new engine instance from file
const engine = new Engine({ engineConfig: 'path/to/config.json' });

await engine.start();
app.use(engine.expressMiddleware());

// ...
// other middleware / handlers
// ...

To shut down engine

engine.stop();

The graphql server should have tracing enabled if available. If you are using Apollo Server (v1.1.0 or newer), enable the tracing: true configuration option.

Minimum Engine Configuration

This is the minimum necessary information in the engine configuration object to enable sending tracing and telemetry information.

{
  "apiKey": "service:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

Full Engine Configuration

See the documentation section on configuring the proxy

About

Apollo Engine middleware for Node

License:Other


Languages

Language:JavaScript 58.5%Language:TypeScript 41.5%