apollo-server-express
Production-ready Node.js GraphQL server for Express and Connect
Last updated 9 days ago by apollo-bot .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install apollo-server-express 
SYNC missed versions from official npm registry.

npm version Build Status Join the community on Spectrum

This is the Express and Connect integration of GraphQL Server. Apollo Server is a community-maintained open-source GraphQL server that works with many Node.js HTTP server frameworks. Read the docs. Read the CHANGELOG.

npm install apollo-server-express

Express

const express = require('express');
const { ApolloServer, gql } = require('apollo-server-express');

// Construct a schema, using GraphQL schema language
const typeDefs = gql`
  type Query {
    hello: String
  }
`;

// Provide resolver functions for your schema fields
const resolvers = {
  Query: {
    hello: () => 'Hello world!',
  },
};

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

const app = express();
server.applyMiddleware({ app });

app.listen({ port: 4000 }, () =>
  console.log(`???? Server ready at http://localhost:4000${server.graphqlPath}`)
);

Connect

We recommend using express rather than connect. However, if you wish to use connect, please install connect and qs-middleware, in addition to apollo-server-express.

npm install --save connect qs-middleware apollo-server-express
const connect = require('connect');
const { ApolloServer, gql } = require('apollo-server-express');
const query = require('qs-middleware');

// Construct a schema, using GraphQL schema language
const typeDefs = gql`
  type Query {
    hello: String
  }
`;

// Provide resolver functions for your schema fields
const resolvers = {
  Query: {
    hello: () => 'Hello world!',
  },
};

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

const app = connect();
const path = '/graphql';

app.use(query());
server.applyMiddleware({ app, path });

app.listen({ port: 4000 }, () =>
  console.log(`???? Server ready at http://localhost:4000${server.graphqlPath}`)
);

Note: qs-middleware is only required if running outside of Meteor

Principles

GraphQL Server is built with the following principles in mind:

  • By the community, for the community: GraphQL Server's development is driven by the needs of developers
  • Simplicity: by keeping things simple, GraphQL Server is easier to use, easier to contribute to, and more secure
  • Performance: GraphQL Server is well-tested and production-ready - no modifications needed

Anyone is welcome to contribute to GraphQL Server, just read CONTRIBUTING.md, take a look at the roadmap and make your first PR!

Current Tags

  • 2.13.0-alpha.0                                ...           alpha (3 months ago)
  • 2.15.1                                ...           latest (9 days ago)
  • 2.15.0-alpha.1                                ...           next (22 days ago)

207 Versions

  • 2.15.1                                ...           9 days ago
  • 2.15.0                                ...           22 days ago
  • 2.15.0-alpha.1                                ...           22 days ago
  • 2.14.5                                ...           22 days ago
  • 2.15.0-alpha.0                                ...           23 days ago
  • 2.14.4                                ...           a month ago
  • 2.14.3                                ...           a month ago
  • 2.14.2                                ...           a month ago
  • 2.14.1                                ...           a month ago
  • 2.14.0                                ...           a month ago
  • 2.14.0-alpha.2                                ...           2 months ago
  • 2.14.0-alpha.1                                ...           2 months ago
  • 2.14.0-alpha.0                                ...           2 months ago
  • 2.13.1                                ...           2 months ago
  • 2.13.1-alpha.1                                ...           2 months ago
  • 2.13.1-alpha.0                                ...           2 months ago
  • 2.13.0                                ...           2 months ago
  • 2.13.0-alpha.1                                ...           3 months ago
  • 2.13.0-alpha.0                                ...           3 months ago
  • 2.12.0                                ...           3 months ago
  • 2.12.0-alpha.5                                ...           3 months ago
  • 2.12.0-alpha.4                                ...           3 months ago
  • 2.12.0-alpha.3                                ...           3 months ago
  • 2.12.0-alpha.2                                ...           4 months ago
  • 2.12.0-alpha.1                                ...           4 months ago
  • 2.12.0-alpha.0                                ...           4 months ago
  • 2.11.0                                ...           4 months ago
  • 2.11.0-alpha.3                                ...           4 months ago
  • 2.11.0-alpha.2                                ...           4 months ago
  • 2.11.0-alpha.1                                ...           4 months ago
  • 2.10.1                                ...           5 months ago
  • 2.10.0                                ...           5 months ago
  • 2.9.16                                ...           6 months ago
  • 2.9.15                                ...           6 months ago
  • 2.9.14                                ...           7 months ago
  • 2.9.13                                ...           7 months ago
  • 2.9.12                                ...           8 months ago
  • 2.9.11                                ...           8 months ago
  • 2.9.10 [deprecated]           ...           8 months ago
  • 2.9.9                                ...           8 months ago
  • 2.9.8                                ...           8 months ago
  • 2.9.7                                ...           9 months ago
  • 2.9.6                                ...           9 months ago
  • 2.9.5                                ...           9 months ago
  • 2.9.4                                ...           9 months ago
  • 2.9.3                                ...           10 months ago
  • 2.9.2                                ...           10 months ago
  • 2.9.1                                ...           10 months ago
  • 2.9.0                                ...           a year ago
  • 2.8.2                                ...           a year ago
  • 2.8.1                                ...           a year ago
  • 2.8.0                                ...           a year ago
  • 2.7.2                                ...           a year ago
  • 2.7.1                                ...           a year ago
  • 2.7.0                                ...           a year ago
  • 2.7.0-alpha.14                                ...           a year ago
  • 2.7.0-alpha.13                                ...           a year ago
  • 2.7.0-alpha.12                                ...           a year ago
  • 2.7.0-alpha.9                                ...           a year ago
  • 2.6.9                                ...           a year ago
  • 2.6.8                                ...           a year ago
  • 2.7.0-alpha.8                                ...           a year ago
  • 2.7.0-alpha.7                                ...           a year ago
  • 2.7.0-alpha.6                                ...           a year ago
  • 2.7.0-alpha.5                                ...           a year ago
  • 2.7.0-alpha.4                                ...           a year ago
  • 2.7.0-alpha.3                                ...           a year ago
  • 2.7.0-alpha.2                                ...           a year ago
  • 2.7.0-alpha.1                                ...           a year ago
  • 2.7.0-alpha.0                                ...           a year ago
  • 2.6.7                                ...           a year ago
  • 2.6.7-alpha.0                                ...           a year ago
  • 2.6.6                                ...           a year ago
  • 2.6.5                                ...           a year ago
  • 2.6.5-alpha.0                                ...           a year ago
  • 2.6.4                                ...           a year ago
  • 2.6.3                                ...           a year ago
  • 2.6.2                                ...           a year ago
  • 2.6.2-alpha.0                                ...           a year ago
  • 2.6.1                                ...           a year ago
  • 2.6.1-alpha.0                                ...           a year ago
  • 2.6.0                                ...           a year ago
  • 2.6.0-rc.0                                ...           a year ago
  • 2.6.0-alpha.9                                ...           a year ago
  • 2.5.1                                ...           a year ago
  • 2.5.1-alpha.1                                ...           a year ago
  • 2.5.1-alpha.0                                ...           a year ago
  • 2.6.0-alpha.8                                ...           a year ago
  • 2.6.0-alpha.7                                ...           a year ago
  • 2.6.0-alpha.6                                ...           a year ago
  • 2.6.0-alpha.5                                ...           a year ago
  • 2.6.0-alpha.4                                ...           a year ago
  • 2.6.0-alpha.3                                ...           a year ago
  • 2.6.0-alpha.2                                ...           a year ago
  • 2.6.0-alpha.1                                ...           a year ago
  • 2.6.0-alpha.0                                ...           a year ago
  • 2.5.1-alpha.15                                ...           a year ago
  • 2.5.1-alpha.14                                ...           a year ago
  • 2.5.0                                ...           a year ago
  • 2.5.0-rc.0                                ...           a year ago
  • 2.5.0-alpha.7                                ...           a year ago
  • 2.5.0-alpha.6                                ...           a year ago
  • 2.5.0-alpha.5                                ...           a year ago
  • 2.5.0-alpha.4                                ...           a year ago
  • 2.5.0-alpha.3                                ...           a year ago
  • 2.5.0-alpha.2                                ...           a year ago
  • 2.5.0-alpha.1                                ...           a year ago
  • 2.5.0-alpha.0                                ...           a year ago
  • 2.4.8                                ...           a year ago
  • 2.4.7                                ...           a year ago
  • 2.4.6                                ...           a year ago
  • 2.4.5                                ...           a year ago
  • 2.4.4                                ...           a year ago
  • 2.4.3                                ...           a year ago
  • 2.4.2                                ...           a year ago
  • 2.4.2-rc.0                                ...           a year ago
  • 2.4.1                                ...           a year ago
  • 2.4.0                                ...           a year ago
  • 2.4.0-alpha.4                                ...           a year ago
  • 2.3.3                                ...           a year ago
  • 2.3.2                                ...           a year ago
  • 2.4.0-alpha.3                                ...           a year ago
  • 2.4.0-alpha.2                                ...           a year ago
  • 2.4.0-alpha.1                                ...           a year ago
  • 2.4.0-alpha.0                                ...           2 years ago
  • 2.3.1                                ...           2 years ago
  • 2.3.0                                ...           2 years ago
  • 2.2.7                                ...           2 years ago
  • 2.3.0-alpha.0                                ...           2 years ago
  • 2.2.7-alpha.0                                ...           2 years ago
  • 2.2.6                                ...           2 years ago
  • 2.2.5                                ...           2 years ago
  • 2.2.4                                ...           2 years ago
  • 2.2.3                                ...           2 years ago
  • 2.2.2                                ...           2 years ago
  • 2.2.1                                ...           2 years ago
  • 2.2.0                                ...           2 years ago
  • 2.2.0-alpha.4                                ...           2 years ago
  • 2.2.0-alpha.3                                ...           2 years ago
  • 2.2.0-alpha.2                                ...           2 years ago
  • 2.2.0-alpha.1                                ...           2 years ago
  • 2.2.0-alpha.0                                ...           2 years ago
  • 2.2.0-register.2195                                ...           2 years ago
  • 2.1.0                                ...           2 years ago
  • 2.0.7                                ...           2 years ago
  • 2.0.6                                ...           2 years ago
  • 2.0.5                                ...           2 years ago
  • 2.0.4                                ...           2 years ago
  • 2.0.3                                ...           2 years ago
  • 2.0.2                                ...           2 years ago
  • 2.0.1                                ...           2 years ago
  • 2.1.0-alpha.10                                ...           2 years ago
  • 2.1.0-alpha.9                                ...           2 years ago
  • 2.1.0-alpha.8                                ...           2 years ago
  • 2.1.0-alpha.7                                ...           2 years ago
  • 2.1.0-alpha.6                                ...           2 years ago
  • 2.1.0-alpha.5                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 2.1.0-alpha.2                                ...           2 years ago
  • 2.1.0-alpha.1                                ...           2 years ago
  • 2.0.0-rc.12                                ...           2 years ago
  • 2.1.0-alpha.0                                ...           2 years ago
  • 2.0.0-rc.10                                ...           2 years ago
  • 2.0.0-rc.9                                ...           2 years ago
  • 2.0.0-rc.8                                ...           2 years ago
  • 1.4.0                                ...           2 years ago
  • 2.0.0-rc.7                                ...           2 years ago
  • 2.0.0-rc.6                                ...           2 years ago
  • 2.0.0-rc.5                                ...           2 years ago
  • 2.0.0-rc.4                                ...           2 years ago
  • 2.0.0-rc.3                                ...           2 years ago
  • 2.0.0-rc.2                                ...           2 years ago
  • 2.0.0-rc.1                                ...           2 years ago
  • 2.0.0-rc.0                                ...           2 years ago
  • 2.0.0-beta.11                                ...           2 years ago
  • 2.0.0-beta.10                                ...           2 years ago
  • 2.0.0-beta.9                                ...           2 years ago
  • 2.0.0-beta.8                                ...           2 years ago
  • 2.0.0-beta.7                                ...           2 years ago
  • 2.0.0-beta.6                                ...           2 years ago
  • 2.0.0-beta.5                                ...           2 years ago
  • 2.0.0-beta.3                                ...           2 years ago
  • 2.0.0-beta.2                                ...           2 years ago
  • 2.0.0-beta.1                                ...           2 years ago
  • 2.0.0-beta.0                                ...           2 years ago
  • 1.3.6                                ...           2 years ago
  • 1.3.5                                ...           2 years ago
  • 1.3.4                                ...           2 years ago
  • 1.3.3                                ...           2 years ago
  • 1.3.2                                ...           3 years ago
  • 1.3.1                                ...           3 years ago
  • 1.3.0                                ...           3 years ago
  • 1.2.0                                ...           3 years ago
  • 1.2.0-pre.1                                ...           3 years ago
  • 1.1.7                                ...           3 years ago
  • 1.1.6                                ...           3 years ago
  • 1.1.5                                ...           3 years ago
  • 1.1.3                                ...           3 years ago
  • 1.1.2                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.5                                ...           3 years ago
  • 1.0.4                                ...           3 years ago
  • 1.0.3-tracing.3                                ...           3 years ago
  • 1.0.3-tracing.2                                ...           3 years ago
  • 1.0.3-tracing.1                                ...           3 years ago
  • 1.0.3-tracing.0                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
Downloads
Today 1,648
This Week 13,974
This Month 29,824
Last Day 4,489
Last Week 24,760
Last Month 112,152
Dev Dependencies (1)
Dependents (687)

Copyright 2014 - 2016 © taobao.org |