Skip to content

Commit

Permalink
Include example in Micro README
Browse files Browse the repository at this point in the history
  • Loading branch information
megamaddu committed Jun 15, 2017
1 parent 2d1d25e commit 7f7d24e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/graphql-server-micro/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
# graphql-server-micro

This is the [Micro](https://github.com/zeit/micro) integration for the Apollo community GraphQL Server. [Read the docs.](http://dev.apollodata.com/tools/apollo-server/index.html)


## Example
```typescript
import { microGraphiql, microGraphql } from "graphql-server-micro";
import micro, { send } from "micro";
import { get, post, router } from "microrouter";
import schema from "./schema";

const graphqlHandler: microGraphql({ schema });

const server = micro(
router(
get("/graphql", graphqlHandler),
post("/graphql", graphqlHandler),
get("/graphiql", microGraphiql({ endpointURL: "/graphql" })),
(req, res) => send(res, 404, "404 Not found."),
),
);

server.listen(3000);
```

0 comments on commit 7f7d24e

Please sign in to comment.