Skip to content

Commit 0ff21db

Browse files
committed
GraphiQL note
1 parent 0047dc7 commit 0ff21db

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ has the following aims:
1212
- [x] Graphile-build schema plugin support
1313
- [x] Support for middlewares
1414
- [x] No requirement for Node.js `http`-based libraries (such as Connect,
15-
Express, Koa)
15+
Express, Koa)
1616

1717
## Non-goals
1818

1919
Postgraphile-lambda-example does NOT intend to watch the schema for changes;
20-
this means that you *must* build and release a new version every time you
20+
this means that you _must_ build and release a new version every time you
2121
change your database. (You only need to update the cache file though.)
2222

2323
Postgraphile-lambda-example does NOT intend to make this fully compatible with
@@ -75,6 +75,12 @@ This will result in a `lambda.zip` file that you can upload to Amazon Lambda.
7575
11. Finally, go to "Actions" again and "Deploy API"
7676
12. Copy the "Invoke URL" and paste it into your GraphQL client of choice - you can now talk to your Lambda PostGraphile API 😅
7777

78+
If you want GraphiQL support (STRONGLY DISCOURAGED! Use an external GraphQL
79+
client such as GraphiQL.app, Altair or GraphQL Playground instead!), then you
80+
need to go back to stage 9, and choose 'Create Resource', tick "Configure as a
81+
proxy resource", press "Create Resource" and then configure it with the name of
82+
your lambda function, you should also change the settings in
83+
`src/postgraphileOptions.js` (see comment in that file).
7884

7985
## How it works
8086

@@ -120,8 +126,8 @@ Left as an exercise to the reader.
120126

121127
### Test Prerequisites
122128

123-
* [docker](https://docs.docker.com/install/)
124-
* [aws sam cli](https://docs.aws.amazon.com/lambda/latest/dg/sam-cli-requirements.html) - `pip install aws-sam-cli`
129+
- [docker](https://docs.docker.com/install/)
130+
- [aws sam cli](https://docs.aws.amazon.com/lambda/latest/dg/sam-cli-requirements.html) - `pip install aws-sam-cli`
125131

126132
### Running tests
127133

@@ -173,7 +179,7 @@ If you're using the sample database then you can generate a JWT via:
173179

174180
```graphql
175181
mutation {
176-
authenticate(input: {email: "[email protected]", password: "iFbWWlc"}) {
182+
authenticate(input: { email: "[email protected]", password: "iFbWWlc" }) {
177183
jwtToken
178184
}
179185
}
@@ -203,7 +209,6 @@ Then you can issue an authenticated query:
203209

204210
Note that SAM unpacks the zip and reboots node for every single request, so you're going to suffer some startup latency with this.
205211

206-
207212
### Thanks
208213

209214
Improvements to PostGraphile's support for Lambda were sponsored by [Connecting Good](https://cogo.co/)

src/postgraphileOptions.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
exports.options = {
22
dynamicJson: true,
33
graphiql: false,
4-
/* If you enable GraphiQL, you must use `absoluteRoutes` and give the routes to the endpoints.:
4+
/* If you want to enable GraphiQL, you must use `absoluteRoutes` and give the routes
5+
* to the endpoints. Doing this is strongly discouraged, you should use an external
6+
* GraphQL client instead.
57
68
absoluteRoutes: true,
7-
graphqlRoute: '/default/graphql',
9+
graphqlRoute: '/default',
810
graphiqlRoute: '/default/graphiql',
911
*/
1012
cors: true,

0 commit comments

Comments
 (0)