apollo-server/packages/apollo-server-micro
2018-05-24 15:43:17 -07:00
..
src apollo-server-core: add request object to runHttpQuery for access to headers (#1096) 2018-05-24 15:43:17 -07:00
.npmignore include readme for npm packages 2017-10-23 15:13:31 -07:00
package.json package.json: beta.2 for apollo-server, beta.1 for core/express, beta.0 for hapi 2018-05-22 11:16:59 -07:00
README.md Update status badges for Circle correctly 2018-03-28 14:03:32 -07:00
tsconfig.json tsconfig: remove typeRoots from tsconfig and automatic retreival of node types 2018-05-21 15:29:37 -07:00

title description
Micro Setting up Apollo Server with Micro

npm version Build Status Coverage Status Get on Slack

This is the Micro integration for the Apollo community GraphQL Server. Read the docs. Read the CHANGELOG.

npm install apollo-server-micro

Example

import { microGraphiql, microGraphql } from 'apollo-server-micro';
import micro, { send } from 'micro';
import { get, post, router } from 'microrouter';
import schema from './schema';

const graphqlHandler = microGraphql({ schema });
const graphiqlHandler = microGraphiql({ endpointURL: '/graphql' });

const server = micro(
  router(
    get('/graphql', graphqlHandler),
    post('/graphql', graphqlHandler),
    get('/graphiql', graphiqlHandler),
    (req, res) => send(res, 404, 'not found'),
  ),
);

server.listen(3000);