[英]How to configure GraphQL extension for VSCode?
我正在尝试配置 VSCode GraphQL扩展,但它的信息对我来说有些模糊。
我有这个基本的 Flutter 项目结构:
.
├── analysis_options.yaml
├── android
├── assets
├── lib
│ ├── graphql
│ │ └── *.gql
│ ├── main.dart
│ ├── private
│ │ └── graphql.config.json
│ └── shared
├── pubspec.lock
├── pubspec.yaml
├── README.md
├── test
└── tutorial_with_hasura_server.iml
我已经使用以下设置将graphql.config.json
创建到./lib/private
目录中:
{
"schema": {
"request": {
"url": "https://hasura.io/learn/graphql",
"method": "POST",
"postIntrospectionQuery": true,
"options": {
"headers": {
"Authorization": "Bearer 1234567890123456789"
}
}
}
}
}
同时在 VSCode settings.json
我添加了这一行:
"graphql-config.load.filePath": "./lib/private/graphql.config.json",
我正在尝试运行一个简单的 GraphQL 查询操作,该操作存储在./lib/graphql
目录中扩展名为 GQL 的文件中,但没有结果,没有错误消息,什么都没有。 我错过了什么?
这个配置对我有用:
{
"extensions": {
"endpoints": {
"default": {
"url": "https://hasura.io/learn/graphql",
"headers": {
"Authorization": "Bearer 1234567890123456789"
}
}
}
}
}
如果这不起作用,您可能需要将其包装在项目中:
{
"projects": {
"lib": {
"extensions": {
"endpoints": {
"default": {
"url": "https://hasura.io/learn/graphql",
"headers": {
"Authorization": "Bearer 1234567890123456789"
}
}
}
}
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.