Installing

How to install Apollo Server

Apollo server is a flexible, community driven, production-ready HTTP Apollo Server plugin for Node.js.

It works with any GraphQL schema built with GraphQL.js, Facebook’s reference JavaScript execution library, and you can use Apollo Server with all popular JavaScript HTTP servers, including Express, Connect, Hapi, Koa, Restify, and Lambda.

This server can be queried from any popular GraphQL client, such as Apollo or Relay because it supports all of the common semantics for sending GraphQL over HTTP, as documented on graphql.org. Apollo Server also supports some small extensions to the protocol, such as sending multiple GraphQL operations in one request. Read more on the sending requests page.

Install it with:

1
2
3
4
5
6
7
# Pick the one that matches your server framework
npm install graphql apollo-server-express # for Express or Connect
npm install graphql apollo-server-hapi
npm install graphql apollo-server-koa
npm install graphql apollo-server-restify
npm install graphql apollo-server-lambda
npm install graphql apollo-server-micro

The following features distinguish Apollo Server from express-graphql, Facebook’s reference HTTP server implementation:

  • Apollo Server has a simpler interface and allows fewer ways of sending queries, which makes it a bit easier to reason about what’s going on.
  • Apollo Server serves GraphiQL on a separate route, giving you more flexibility to decide when and how to serve it.
  • Apollo Server supports query batching which can help reduce load on your server.
  • Apollo Server has built-in support for persisted queries, which can make your app faster and your server more secure.
Edit on GitHub