Apollo Server

3.13.0 · deprecated · verified Sat Apr 18

Apollo Server is a community-maintained open-source GraphQL server that works with many Node.js HTTP server frameworks or can run standalone. Version 3.13.0 is the final stable release of this package, which has since been superseded by the `@apollo/server` package (v4+). Active development and new features are now released under the `@apollo/server` package, which follows a rapid release cadence.

Common errors

Warnings

Install

Imports

Quickstart

Basic Apollo Server setup with a 'hello world' GraphQL query that starts a standalone server.

import { ApolloServer, gql } from 'apollo-server';

// The GraphQL schema
const typeDefs = gql`
  type Query {
    "A simple type for getting started!"
    hello: String
  }
`;

// A map of functions which return data for the schema.
const resolvers = {
  Query: {
    hello: () => 'world',
  },
};

const server = new ApolloServer({
  typeDefs,
  resolvers,
});

server.listen().then(({ url }) => {
  console.log(`🚀 Server ready at ${url}`);
});

view raw JSON →