mirror of
https://github.com/vale981/apollo-server
synced 2025-03-06 10:11:40 -05:00
![]() * Setup prettier and precommit hooks * Format code with prettier * Use husky because it works... * Move prettier config to .prettierrc file * Implement fixing markdown file formatting when running lint-fix script * Format markdown files * Add .json file formatting * Fixes json file formatting * Add pretteir linting step * Remove tslint * Use gitignore for prettier * Fix linting errors * Ignore submodule folder |
||
---|---|---|
.. | ||
src | ||
.npmignore | ||
package.json | ||
README.md | ||
tsconfig.json |
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);