Skip to content

Commit

Permalink
enable graphiql headers editor, see graphql/graphiql/issues/59, https…
Browse files Browse the repository at this point in the history
  • Loading branch information
liudonghua123 committed Aug 27, 2020
1 parent 0bda07d commit 051d6f6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
8 changes: 5 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const express = require("express");
const cors = require('cors')
const bodyParser = require("body-parser");
const graphqlHttp = require("express-graphql");
const { graphqlHTTP } = require("express-graphql");
const mongoose = require("mongoose");
const isAuth = require("./middleware/is-auth");

Expand All @@ -22,10 +22,12 @@ app.use(isAuth);

app.use(
"/graphql",
graphqlHttp({
graphqlHTTP({
schema: graphqlSchema,
rootValue: graphqlResolvers,
graphiql: true
graphiql: {
headerEditorEnabled: true,
},
})
);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"cors": "^2.8.5",
"dotenv": "^8.0.0",
"express": "^4.17.1",
"express-graphql": "^0.8.0",
"express-graphql": "^0.11.0",
"graphql": "^14.3.1",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.5.14"
Expand Down
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ abbrev@1:
resolved "https://registry.npm.taobao.org/abbrev/download/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
integrity sha1-+PLIh60Qv2f2NPAFtph/7TF5qsg=

accepts@^1.3.5, accepts@~1.3.7:
accepts@^1.3.7, accepts@~1.3.7:
version "1.3.7"
resolved "https://registry.npm.taobao.org/accepts/download/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd"
integrity sha1-UxvHJlF6OytB+FACHGzBXqq1B80=
Expand Down Expand Up @@ -604,15 +604,15 @@ expand-brackets@^2.1.4:
snapdragon "^0.8.1"
to-regex "^3.0.1"

express-graphql@^0.8.0:
version "0.8.0"
resolved "https://registry.npm.taobao.org/express-graphql/download/express-graphql-0.8.0.tgz#5d434709bcabe6d5527751730376d8265a197976"
integrity sha1-XUNHCbyr5tVSd1FzA3bYJloZeXY=
express-graphql@^0.11.0:
version "0.11.0"
resolved "https://registry.npm.taobao.org/express-graphql/download/express-graphql-0.11.0.tgz#48089f0d40074d7783c65ff86dd9cae95afea2ef"
integrity sha1-SAifDUAHTXeDxl/4bdnK6Vr+ou8=
dependencies:
accepts "^1.3.5"
accepts "^1.3.7"
content-type "^1.0.4"
http-errors "^1.7.2"
raw-body "^2.3.3"
http-errors "1.8.0"
raw-body "^2.4.1"

express@^4.17.1:
version "4.17.1"
Expand Down Expand Up @@ -878,7 +878,7 @@ http-errors@1.7.3, http-errors@~1.7.2:
statuses ">= 1.5.0 < 2"
toidentifier "1.0.0"

http-errors@^1.7.2:
http-errors@1.8.0:
version "1.8.0"
resolved "https://registry.npm.taobao.org/http-errors/download/http-errors-1.8.0.tgz?cache=0&sync_timestamp=1593407634112&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fhttp-errors%2Fdownload%2Fhttp-errors-1.8.0.tgz#75d1bbe497e1044f51e4ee9e704a62f28d336507"
integrity sha1-ddG75JfhBE9R5O6ecEpi8o0zZQc=
Expand Down Expand Up @@ -1762,7 +1762,7 @@ raw-body@2.4.0:
iconv-lite "0.4.24"
unpipe "1.0.0"

raw-body@^2.3.3:
raw-body@^2.4.1:
version "2.4.1"
resolved "https://registry.npm.taobao.org/raw-body/download/raw-body-2.4.1.tgz#30ac82f98bb5ae8c152e67149dac8d55153b168c"
integrity sha1-MKyC+Yu1rowVLmcUnayNVRU7Fow=
Expand Down

0 comments on commit 051d6f6

Please sign in to comment.