Skip to content

Commit

Permalink
Rename packages from graphql-server- to apollo-server- (#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnwalraven committed Jul 17, 2017
1 parent 576e7b8 commit 300c0cd
Show file tree
Hide file tree
Showing 103 changed files with 728 additions and 316 deletions.
76 changes: 38 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
# GraphQL Server for Express, Connect, Hapi, Koa, Restify and AWS Lambda

[![npm version](https://badge.fury.io/js/graphql-server-core.svg)](https://badge.fury.io/js/graphql-server-core)
[![Build Status](https://travis-ci.org/apollographql/graphql-server.svg?branch=master)](https://travis-ci.org/apollographql/graphql-server)
[![Coverage Status](https://coveralls.io/repos/github/apollographql/graphql-server/badge.svg?branch=master)](https://coveralls.io/github/apollographql/graphql-server?branch=master)
[![npm version](https://badge.fury.io/js/apollo-server-core.svg)](https://badge.fury.io/js/apollo-server-core)
[![Build Status](https://travis-ci.org/apollographql/apollo-server.svg?branch=master)](https://travis-ci.org/apollographql/apollo-server)
[![Coverage Status](https://coveralls.io/repos/github/apollographql/apollo-server/badge.svg?branch=master)](https://coveralls.io/github/apollographql/apollo-server?branch=master)
[![Get on Slack](https://img.shields.io/badge/slack-join-orange.svg)](http://www.apollodata.com/#slack)

GraphQL Server is a community-maintained open-source GraphQL server. It works with all Node.js HTTP server frameworks: Express, Connect, Hapi, Koa and Restify.
Apollo Server is a community-maintained open-source GraphQL server. It works with all Node.js HTTP server frameworks: Express, Connect, Hapi, Koa and Restify.

## Principles

GraphQL Server is built with the following principles in mind:
Apollo 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
* **By the community, for the community**: Apollo Server's development is driven by the needs of developers
* **Simplicity**: by keeping things simple, Apollo Server is easier to use, easier to contribute to, and more secure
* **Performance**: Apollo Server is well-tested and production-ready - no modifications needed


Anyone is welcome to contribute to GraphQL Server, just read [CONTRIBUTING.md](./CONTRIBUTING.md), take a look at the [roadmap](./ROADMAP.md) and make your first PR!
Anyone is welcome to contribute to Apollo Server, just read [CONTRIBUTING.md](./CONTRIBUTING.md), take a look at the [roadmap](./ROADMAP.md) and make your first PR!


## Getting started

GraphQL Server is super easy to set up. Just `npm install graphql-server-<variant>`, write a GraphQL schema, and then use one of the following snippets to get started. For more info, read the [GraphQL Server docs](http://dev.apollodata.com/tools/graphql-server/index.html).
Apollo Server is super easy to set up. Just `npm install apollo-server-<variant>`, write a GraphQL schema, and then use one of the following snippets to get started. For more info, read the [Apollo Server docs](http://dev.apollodata.com/tools/apollo-server/index.html).

### Installation

Just run `npm install --save graphql-server-<variant>` and you're good to go!
Just run `npm install --save apollo-server-<variant>` and you're good to go!

where variant is one of the following:
- express
Expand All @@ -40,7 +40,7 @@ where variant is one of the following:
```js
import express from 'express';
import bodyParser from 'body-parser';
import { graphqlExpress } from 'graphql-server-express';
import { graphqlExpress } from 'apollo-server-express';

const myGraphQLSchema = // ... define or import your schema here!
const PORT = 3000;
Expand All @@ -57,7 +57,7 @@ app.listen(PORT);
```js
import connect from 'connect';
import bodyParser from 'body-parser';
import { graphqlConnect } from 'graphql-server-express';
import { graphqlConnect } from 'apollo-server-express';
import http from 'http';

const PORT = 3000;
Expand All @@ -77,7 +77,7 @@ Now with the Hapi plugins `graphqlHapi` and `graphiqlHapi` you can pass a route

```js
import hapi from 'hapi';
import { graphqlHapi } from 'graphql-server-hapi';
import { graphqlHapi } from 'apollo-server-hapi';

const server = new hapi.Server();

Expand Down Expand Up @@ -115,7 +115,7 @@ server.start((err) => {
import koa from 'koa'; // koa@2
import koaRouter from 'koa-router'; // koa-router@next
import koaBody from 'koa-bodyparser'; // koa-bodyparser@next
import { graphqlKoa } from 'graphql-server-koa';
import { graphqlKoa } from 'apollo-server-koa';

const app = new koa();
const router = new koaRouter();
Expand All @@ -135,12 +135,12 @@ app.listen(PORT);
### Restify
```js
import restify from 'restify';
import { graphqlRestify, graphiqlRestify } from 'graphql-server-restify';
import { graphqlRestify, graphiqlRestify } from 'apollo-server-restify';

const PORT = 3000;

const server = restify.createServer({
title: 'GraphQL Server'
title: 'Apollo Server'
});

const graphQLOptions = { schema: myGraphQLSchema };
Expand All @@ -161,7 +161,7 @@ server.listen(PORT, () => console.log(`Listening on ${PORT}`));
Lambda function should be run with Node.js v4.3. Requires an API Gateway with Lambda Proxy Integration.

```js
var server = require("graphql-server-lambda");
var server = require("apollo-server-lambda");

exports.handler = server.graphqlLambda({ schema: myGraphQLSchema });
```
Expand All @@ -171,14 +171,14 @@ exports.handler = server.graphqlLambda({ schema: myGraphQLSchema });
Requires the [Micro](https://github.com/zeit/micro) module

```js
const server = require("graphql-server-micro");
const server = require("apollo-server-micro");

module.exports = server.microGraphql({ schema: myGraphQLSchema });
```

## Options

GraphQL Server can be configured with an options object with the the following fields:
Apollo Server can be configured with an options object with the the following fields:

* **schema**: the GraphQLSchema to be used
* **context**: the context value passed to resolvers during GraphQL execution
Expand Down Expand Up @@ -208,28 +208,28 @@ graphqlOptions = {

## Differences to express-graphql

GraphQL Server and express-graphql are more or less the same thing (GraphQL middleware for Node.js), but there are a few key differences:
Apollo Server and express-graphql are more or less the same thing (GraphQL middleware for Node.js), but there are a few key differences:

* express-graphql works with Express and Connect, GraphQL Server supports Express, Connect, Hapi, Koa and Restify.
* express-graphql's main goal is to be a minimal reference implementation, whereas GraphQL Server's goal is to be a complete production-ready GraphQL server.
* Compared to express-graphql, GraphQL Server has a simpler interface and supports exactly one way of passing queries.
* GraphQL Server separates serving GraphiQL (GraphQL UI) from responding to GraphQL requests.
* express-graphql contains code for parsing HTTP request bodies, GraphQL Server leaves that to standard packages like body-parser.
* express-graphql works with Express and Connect, Apollo Server supports Express, Connect, Hapi, Koa and Restify.
* express-graphql's main goal is to be a minimal reference implementation, whereas Apollo Server's goal is to be a complete production-ready GraphQL server.
* Compared to express-graphql, Apollo Server has a simpler interface and supports exactly one way of passing queries.
* Apollo Server separates serving GraphiQL (GraphQL UI) from responding to GraphQL requests.
* express-graphql contains code for parsing HTTP request bodies, Apollo Server leaves that to standard packages like body-parser.
* Includes an `OperationStore` to easily manage whitelisting
* Built with TypeScript

Despite express-graphql being a reference implementation, GraphQL Server is actually easier to understand and more modular than express-graphql.
Despite express-graphql being a reference implementation, Apollo Server is actually easier to understand and more modular than express-graphql.

That said, GraphQL Server is heavily inspired by express-graphql (it's the reference implementation after all). Rather than seeing the two as competing alternatives, we think that they both have separate roles in the GraphQL ecosystem: express-graphql is a reference implementation, and GraphQL Server is a GraphQL server to be used in production and evolve quickly with the needs of the community. Over time, express-graphql can adopt those features of GraphQL Server that have proven their worth and become established more widely.
That said, Apollo Server is heavily inspired by express-graphql (it's the reference implementation after all). Rather than seeing the two as competing alternatives, we think that they both have separate roles in the GraphQL ecosystem: express-graphql is a reference implementation, and Apollo Server is a GraphQL server to be used in production and evolve quickly with the needs of the community. Over time, express-graphql can adopt those features of Apollo Server that have proven their worth and become established more widely.

### application/graphql requests

express-graphql supports the `application/graphql` Content-Type for requests, which is an alternative to `application/json` request with only the query part sent as text. In the same way that we use `bodyParser.json` to parse `application/json` requests for graphql-server, we can use `bodyParser.text` plus one extra step in order to also parse `application/graphql` requests. Here's an example for express:
express-graphql supports the `application/graphql` Content-Type for requests, which is an alternative to `application/json` request with only the query part sent as text. In the same way that we use `bodyParser.json` to parse `application/json` requests for apollo-server, we can use `bodyParser.text` plus one extra step in order to also parse `application/graphql` requests. Here's an example for express:

```js
import express from 'express';
import bodyParser from 'body-parser';
import { graphqlExpress } from 'graphql-server-express';
import { graphqlExpress } from 'apollo-server-express';

const myGraphQLSchema = // ... define or import your schema here!

Expand All @@ -249,25 +249,25 @@ express()
  .listen(3000);
```

## GraphQL Server Development
## Apollo Server Development

If you want to develop GraphQL Server locally you must follow the following instructions:
If you want to develop Apollo Server locally you must follow the following instructions:

* Fork this repository

* Install the GraphQL Server project in your computer
* Install the Apollo Server project in your computer

```
git clone https://github.com/[your-user]/graphql-server
cd graphql-server
git clone https://github.com/[your-user]/apollo-server
cd apollo-server
npm install
cd packages/graphql-server-<variant>/
cd packages/apollo-server-<variant>/
npm link
```

* Install your local GraphQL Server in other App
* Install your local Apollo Server in other App

```
cd ~/myApp
npm link graphql-server-<variant>
npm link apollo-server-<variant>
```
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"lerna": "2.0.0",
"version": "1.0.1",
"changelog": {
"repo": "apollostack/graphql-server",
"repo": "apollographql/apollo-server",
"labels": {
"tag: breaking change": ":boom: Breaking Change",
"tag: new feature": ":rocket: New Feature",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/apollostack/graphql-server.git"
"url": "git+https://github.com/apollographql/apollo-server.git"
},
"scripts": {
"compile": "lerna exec -- npm run compile",
Expand Down
File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions packages/apollo-server-core/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "apollo-server-core",
"version": "1.0.0",
"description": "Core engine for Apollo GraphQL server",
"main": "dist/index.js",
"scripts": {
"compile": "tsc",
"prepublish": "npm run compile"
},
"repository": {
"type": "git",
"url": "https://github.com/apollographql/apollo-server/tree/master/packages/apollo-server-core"
},
"keywords": [
"GraphQL",
"Apollo",
"Server",
"Javascript"
],
"author": "Jonas Helfer <jonas@helfer.email>",
"license": "MIT",
"bugs": {
"url": "https://github.com/apollographql/apollo-server/issues"
},
"homepage": "https://github.com/apollographql/apollo-server#readme",
"devDependencies": {
"@types/fibers": "0.0.29",
"@types/graphql": "^0.9.0",
"fibers": "1.0.15",
"meteor-promise": "^0.8.2"
},
"peerDependencies": {
"graphql": "^0.9.0 || ^0.10.1"
},
"optionalDependencies": {
"@types/graphql": "^0.9.0"
},
"typings": "dist/index.d.ts",
"typescript": {
"definition": "dist/index.d.ts"
}
}
4 changes: 4 additions & 0 deletions packages/apollo-server-core/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { runQuery, LogFunction, LogMessage, LogStep, LogAction } from './runQuery';
export { runHttpQuery, HttpQueryRequest, HttpQueryError } from './runHttpQuery';
export { default as GraphQLOptions, resolveGraphqlOptions } from './graphqlOptions';

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Anyone is welcome to contribute to GraphQL Server, just read [CONTRIBUTING.md](.
```js
import express from 'express';
import bodyParser from 'body-parser';
import { graphqlExpress } from 'graphql-server-express';
import { graphqlExpress } from 'apollo-server-express';

const myGraphQLSchema = // ... define or import your schema here!
const PORT = 3000;
Expand All @@ -42,7 +42,7 @@ app.listen(PORT);
```js
import connect from 'connect';
import bodyParser from 'body-parser';
import { graphqlConnect } from 'graphql-server-express';
import { graphqlConnect } from 'apollo-server-express';
import http from 'http';

const PORT = 3000;
Expand Down
55 changes: 55 additions & 0 deletions packages/apollo-server-express/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "apollo-server-express",
"version": "1.0.0",
"description": "Production-ready Node.js GraphQL server for Express and Connect",
"main": "dist/index.js",
"scripts": {
"compile": "tsc",
"prepublish": "npm run compile"
},
"repository": {
"type": "git",
"url": "https://github.com/apollographql/apollo-server/tree/master/packages/apollo-server-express"
},
"keywords": [
"GraphQL",
"Apollo",
"Server",
"Express",
"Connect",
"Javascript"
],
"author": "Jonas Helfer <jonas@helfer.email>",
"license": "MIT",
"bugs": {
"url": "https://github.com/apollographql/apollo-server/issues"
},
"homepage": "https://github.com/apollographql/apollo-server#readme",
"dependencies": {
"apollo-server-core": "^1.0.0",
"apollo-server-module-graphiql": "^1.0.0"
},
"devDependencies": {
"@types/body-parser": "1.16.3",
"@types/connect": "^3.4.30",
"@types/express": "^4.0.35",
"@types/multer": "0.0.33",
"body-parser": "^1.17.2",
"connect": "^3.6.2",
"connect-query": "^1.0.0",
"express": "^4.15.3",
"apollo-server-integration-testsuite": "^1.0.0",
"multer": "^1.3.0"
},
"peerDependencies": {
"graphql": "^0.9.0 || ^0.10.1"
},
"optionalDependencies": {
"@types/express": "^4.0.35",
"@types/graphql": "^0.9.1"
},
"typings": "dist/index.d.ts",
"typescript": {
"definition": "dist/index.d.ts"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as bodyParser from 'body-parser';
import { graphqlConnect, graphiqlConnect } from './connectApollo';
import 'mocha';

import testSuite, { schema as Schema, CreateAppOptions } from 'graphql-server-integration-testsuite';
import testSuite, { schema as Schema, CreateAppOptions } from 'apollo-server-integration-testsuite';

function createConnectApp(options: CreateAppOptions = {}) {
const app = connect();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as express from 'express';
import * as bodyParser from 'body-parser';
import { graphqlExpress, graphiqlExpress } from './expressApollo';
import testSuite, { schema as Schema, CreateAppOptions } from 'graphql-server-integration-testsuite';
import testSuite, { schema as Schema, CreateAppOptions } from 'apollo-server-integration-testsuite';
import { expect } from 'chai';
import { GraphQLOptions } from 'graphql-server-core';
import { GraphQLOptions } from 'apollo-server-core';
import 'mocha';

function createApp(options: CreateAppOptions = {}) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as express from 'express';
import * as url from 'url';
import { GraphQLOptions, HttpQueryError, runHttpQuery } from 'graphql-server-core';
import * as GraphiQL from 'graphql-server-module-graphiql';
import { GraphQLOptions, HttpQueryError, runHttpQuery } from 'apollo-server-core';
import * as GraphiQL from 'apollo-server-module-graphiql';

export interface ExpressGraphQLOptionsFunction {
(req?: express.Request, res?: express.Response): GraphQLOptions | Promise<GraphQLOptions>;
Expand Down
12 changes: 12 additions & 0 deletions packages/apollo-server-express/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export {
ExpressGraphQLOptionsFunction,
ExpressHandler,
ExpressGraphiQLOptionsFunction,
graphqlExpress,
graphiqlExpress,
} from './expressApollo';

export {
graphqlConnect,
graphiqlConnect,
} from './connectApollo';
14 changes: 14 additions & 0 deletions packages/apollo-server-express/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "../../tsconfig",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
"typeRoots": [
"node_modules/@types"
]
},
"exclude": [
"node_modules",
"dist"
]
}
File renamed without changes.
Loading

0 comments on commit 300c0cd

Please sign in to comment.