mirror of
https://github.com/vale981/apollo-server
synced 2025-03-12 05:56:40 -04:00

* Freshen up title page * Improve homepage further * File a PR! * Try adding express README to sidebar * Add READMEs to docs * Add example page, overhaul setup * More stuff * Fix all old URLs * Eliminate all mentions of graphql-server * Fix azure functions shit
1.3 KiB
1.3 KiB
title | description |
---|---|
Micro | Setting up Apollo Server with Micro |
This is the Micro integration for the Apollo community GraphQL Server. Read the docs.
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);