Tag: apollo client

不能从apollo-client导入createBatchingNetworkInterface

我正在尝试将graphql与我的vue项目集成。 我按照这些说明: https : //github.com/Akryum/vue-apollo 我有npm根据需要安装“apollo-client”,但由于某种原因,我不能导入“createBatchingNetworkInterface”。 这是我的main.js文件: import Vue from 'vue' import { ApolloClient, createBatchingNetworkInterface } from 'apollo-client' import VueApollo from 'vue-apollo' import App from './App' import router from './router' 这是我的apollo-client的index.d.ts文件: export { print as printAST } from 'graphql/language/printer'; export { ObservableQuery, FetchMoreOptions, UpdateQueryOptions, ApolloCurrentResult } from './core/ObservableQuery'; export { WatchQueryOptions, MutationOptions, SubscriptionOptions, FetchPolicy, FetchMoreQueryOptions, […]

请求开发模式localhost中的Next.js应用程序在不同端口上运行的Graphql API

我目前切换现有的应用程序从创build反应应用程序到next.js,似乎一切正常工作,除了我的API端口运行在另一个节点应用程序在端口4000,我无法从我的next.js应用程序。 我跟着回购的例子,但我不能使它的工作,在生产中我使用nginx作为反向代理没有问题,但我在开发模式。 为了设置与Redux的阿波罗我跟着这个例子: with-apollo-and-redux和代理我用这个例子与自定义反向代理 我知道,我做错了,我现在还搞不清楚 在initApollo.js中 … function create() { return new ApolloClient({ ssrMode: !process.browser, networkInterface: createNetworkInterface({ uri: "/api" }) }); } … 在server.js中 … const devProxy = { "/api/": { target: "http://localhost:4000/api/", changeOrigin: true } }; app .prepare() .then(() => { const server = express(); if (dev && devProxy) { const proxyMiddleware = require('http-proxy-middleware') […]