Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f80b4d2

Browse files
author
Josh Price
committedDec 5, 2015
Update docs and license
1 parent 9af1046 commit f80b4d2

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed
 

‎LICENSE

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
BSD License
22

3-
For GraphQL software
4-
5-
Copyright (c) 2015, Facebook, Inc. All rights reserved.
3+
Copyright (c) 2015, Josh Price All rights reserved.
64

75
Redistribution and use in source and binary forms, with or without modification,
86
are permitted provided that the following conditions are met:

‎README.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@ Allows you to easily mount a GraphQL endpoint in Phoenix.
99

1010
## Installation
1111

12-
1. Make a new Phoenix app
12+
1. Make a new Phoenix app, or add it to your existing app.
1313

1414
```sh
1515
mix phoenix.new hello_graphql --no-ecto
1616
cd hello_graphql
1717
```
1818

19+
Alternatively you could clone the [Phoenix GraphQL example project](https://github.com/joshprice/hello_graphql_phoenix) repo
20+
21+
```sh
22+
git clone https://github.com/joshprice/hello_graphql_phoenix
23+
```
24+
1925
2. Add `plug_graphql` to your list of dependencies in `mix.exs` and install the package with `mix deps.get`.
2026

2127
```elixir
@@ -26,10 +32,9 @@ Allows you to easily mount a GraphQL endpoint in Phoenix.
2632

2733
## Usage
2834

29-
1. Define a Schema. Here's a simple one to try out:
35+
1. Define a simple schema in `web/graphql/test_schema.ex`:
3036

3137
```elixir
32-
# The GraphQL schema we're going to use
3338
defmodule TestSchema do
3439
def schema do
3540
%GraphQL.Schema{
@@ -50,22 +55,21 @@ Allows you to easily mount a GraphQL endpoint in Phoenix.
5055
end
5156
```
5257

53-
2. Add the plug to your `api` pipeline:
58+
2. Your `api` pipeline should have this as a minimum:
5459

5560
```elixir
5661
pipeline :api do
5762
plug :accepts, ["json"]
58-
59-
plug GraphQL.Plug.Endpoint, schema: TestSchema.schema
6063
end
6164
```
6265

63-
3. Add an endpoint so this route fires
66+
3. Mount the GraphQL endpoint as follows:
6467

6568
```elixir
66-
scope "/api", HelloGraphql do
69+
scope "/api" do
6770
pipe_through :api
68-
get "/", PageController, :index
71+
72+
forward "/", GraphQL.Plug.Endpoint, schema: {TestSchema, :schema}
6973
end
7074
```
7175

@@ -91,3 +95,12 @@ This is pretty early days, the graphql execution engine needs a lot more work to
9195

9296
However we can't get there without your help, so any questions, bug reports, feedback,
9397
feature requests and/or PRs are most welcome!
98+
99+
## Acknowledgements
100+
101+
Thanks and appreciation goes to the following contributors for answering many questions and providing helpful feedback:
102+
103+
* Daniel Neighman (https://github.com/hassox)
104+
* Chris McCord (https://github.com/chrismccord)
105+
106+
Thanks also to everyone who has submitted PRs, logged issues, given feedback or asked questions.

0 commit comments

Comments
 (0)
This repository has been archived.