gatsby - 尝试 gatsby-theme-apollo - 服务器不可见
问题描述
入门时遇到问题 https://github.com/apollographql/gatsby-theme-apollo/tree/master/packages/gatsby-theme-apollo
采取的步骤:
> gatsby new atest
> cd atest
> npm install gatsby-theme-apollo @apollo/client
> make new directory: atest/src/gatsby-theme-apollo
> make new file in directory: client.js
> copy paste content from instructions without change:
import fetch from 'isomorphic-fetch';
import {ApolloClient, HttpLink, InMemoryCache} from '@apollo/client';
const client = new ApolloClient({
cache: new InMemoryCache(),
link: new HttpLink({
uri: 'https://api.spacex.land/graphql/',
fetch
})
})
在浏览器中:检查 spacex api 是否启动终端:gatsby 开发浏览器:导航到 localhost:8000/___graphql
查询可用于站点 OK 但是,没有可用的 spacex 查询。缺少任何步骤吗?(在 ubuntu 18.04 节点 12.14.1、gatsby 2.19.7 上)
解决方案
不是问题:只有在连接服务器端 graphql 时,服务器才会与其他 gatsby 模式一起显示,因此这种行为符合预期。客户端查询是单独处理的 - 请参阅https://github.com/jlengstorf/gatsby-with-apollo以及中间相关的 You Tube 视频https://www.youtube.com/watch?v=wNUg1jpj9T0以获得良好的描述.
推荐阅读
- javascript - Angular7:模板解析错误:找不到管道'titlecase'/'slice'
- html - 无法用 R 找到 html 的数据
- xamarin - Xamarin:避免对 iOS 导航栏产生较轻的影响
- android - 适配器的内容发生了变化,但ListView没有收到通知。(Android错误)
- asp.net - 不使用 Jquery-fileupload 插件
- php - PHP - 按字母顺序过滤数组字符串
- php - PHP - 我可以将另一个文件或数据库中的规则导入 .htaccess 文件吗?
- java - ESP8266 - 调用方法 readBytes 后客户端套接字正在关闭
- java - Java-函数好像搞乱了控制台,调用函数后什么都不会打印出来
- excel - 获取公式的完整路径以打开工作簿