2017-12-11 23:11:11 -08:00
---
title: Micro
description: Setting up Apollo Server with Micro
---
2017-04-08 14:17:49 -07:00
2017-12-11 23:11:11 -08:00
[](https://badge.fury.io/js/apollo-server-core) [](https://travis-ci.org/apollographql/apollo-server) [](https://coveralls.io/github/apollographql/apollo-server?branch=master) [](https://www.apollographql.com/#slack )
2017-05-24 00:29:15 -06:00
2018-03-27 09:22:13 -07:00
This is the [Micro ](https://github.com/zeit/micro ) integration for the Apollo community GraphQL Server. [Read the docs. ](https://www.apollographql.com/docs/apollo-server/ ) [Read the CHANGELOG. ](https://github.com/apollographql/apollo-server/blob/master/CHANGELOG.md )
2017-12-11 23:11:11 -08:00
```sh
npm install apollo-server-micro
```
2017-05-24 00:29:15 -06:00
## Example
2017-12-11 23:11:11 -08:00
```js
import { microGraphiql, microGraphql } from 'apollo-server-micro';
import micro, { send } from 'micro';
import { get, post, router } from 'microrouter';
import schema from './schema';
2017-05-24 00:29:15 -06:00
2017-06-05 15:58:10 -06:00
const graphqlHandler = microGraphql({ schema });
2017-12-11 23:11:11 -08:00
const graphiqlHandler = microGraphiql({ endpointURL: '/graphql' });
2017-05-24 00:29:15 -06:00
const server = micro(
router(
2017-12-11 23:11:11 -08:00
get('/graphql', graphqlHandler),
post('/graphql', graphqlHandler),
get('/graphiql', graphiqlHandler),
2018-01-09 00:08:01 +01:00
(req, res) => send(res, 404, 'not found'),
),
2017-05-24 00:29:15 -06:00
);
server.listen(3000);
```