apollo-server-micro
Advanced tools
Comparing version
{ | ||
"name": "apollo-server-micro", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Production-ready Node.js GraphQL server for Micro", | ||
@@ -28,4 +28,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"apollo-server-core": "^1.2.0", | ||
"apollo-server-module-graphiql": "^1.2.0" | ||
"apollo-server-core": "^1.3.0", | ||
"apollo-server-module-graphiql": "^1.3.0" | ||
}, | ||
@@ -35,3 +35,3 @@ "devDependencies": { | ||
"@types/micro": "7.3.1", | ||
"apollo-server-integration-testsuite": "^1.2.0", | ||
"apollo-server-integration-testsuite": "^1.3.0", | ||
"micro": "8.0.4", | ||
@@ -41,3 +41,3 @@ "microrouter": "2.2.3" | ||
"peerDependencies": { | ||
"micro": "^8.0.1" | ||
"micro": "^8.0.1 || ^9.0.1" | ||
}, | ||
@@ -44,0 +44,0 @@ "typings": "dist/index.d.ts", |
@@ -1,23 +0,32 @@ | ||
# graphql-server-micro | ||
--- | ||
title: Micro | ||
description: Setting up Apollo Server with 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) | ||
[](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) | ||
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/) | ||
```sh | ||
npm install apollo-server-micro | ||
``` | ||
## Example | ||
```typescript | ||
import { microGraphiql, microGraphql } from "graphql-server-micro"; | ||
import micro, { send } from "micro"; | ||
import { get, post, router } from "microrouter"; | ||
import schema from "./schema"; | ||
```js | ||
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 graphiqlHandler = microGraphiql({ endpointURL: '/graphql' }); | ||
const server = micro( | ||
router( | ||
get("/graphql", graphqlHandler), | ||
post("/graphql", graphqlHandler), | ||
get("/graphiql", graphiqlHandler), | ||
(req, res) => send(res, 404, "not found"), | ||
), | ||
get('/graphql', graphqlHandler), | ||
post('/graphql', graphqlHandler), | ||
get('/graphiql', graphiqlHandler), | ||
(req, res) => send(res, 404, 'not found') | ||
) | ||
); | ||
@@ -24,0 +33,0 @@ |
15318
4.21%36
33.33%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated