【发布时间】:2019-07-14 02:08:00
【问题描述】:
我正在使用 Express 运行 Apollo Server 2.0 来构建 GraphQL API 原型。这是我的 ApolloServer init 的样子(我的服务器脚本的一部分):
// GraphQL: Schema
const server = new ApolloServer({
typeDefs,
resolvers,
playground: {
endpoint: `/blog/`,
settings: './playground.json'
}
});
按照Prisma Github page 上的建议,我将设置值抽象为一个单独的 JSON 文件,如下所示:
// playground.json
{
"general.betaUpdates": false,
"editor.cursorShape": "line",
"editor.fontSize": 14,
"editor.fontFamily": "'Source Code Pro', 'Consolas', 'Inconsolata', 'Droid Sans Mono', 'Monaco', monospace",
"editor.theme": "dark",
"editor.reuseHeaders": true,
"prettier.printWidth": 80,
"request.credentials": "omit",
"tracing.hideTracingResponse": true
}
此设置运行良好。除了当我运行服务器并在浏览器中查看加载到 Playground 的设置时,我注意到 JSON 中有一些奇怪但无害的条目:
{
"0": ".",
"1": "/",
"2": "p",
"3": "l",
"4": "a",
"5": "y",
"6": "g",
"7": "r",
"8": "o",
"9": "u",
"10": "n",
"11": "d",
"12": ".",
"13": "j",
"14": "s",
"15": "o",
"16": "n",
"general.betaUpdates": false,
"editor.cursorShape": "line",
"editor.fontSize": 14,
"editor.fontFamily": "'Source Code Pro', 'Consolas', 'Inconsolata', 'Droid Sans Mono', 'Monaco', monospace",
"editor.theme": "dark",
"editor.reuseHeaders": true,
"prettier.printWidth": 80,
"request.credentials": "omit",
"tracing.hideTracingResponse": true
}
知道可能出了什么问题吗?
【问题讨论】:
标签: graphql apollo-server