我不确定我做错了什么。我不能质疑这似乎是一个使用GraphQL的非常简单的应用程序接口?
我尝试过不同的解决方案。但我得到了相同的错误/问题。
import { ApolloServer, gql, IResolverObject } from "apollo-server";
import fetch from "node-fetch";
const typeDefs = gql`
type Company {
organisasjonsnummer: Int
navn: String
}
type
我只是想知道这种看似笨拙的配置(来自)的原因是什么?
const server = new ApolloServer({
// These will be defined for both new or existing servers
typeDefs,
resolvers,
});
server.applyMiddleware({ app }); // app is from an existing express app
为什么我调用.applyMiddleware()并提供给它我的app,而不是使用,它甚至从文档中看起来阿波罗只在/graphql上回答请求,
let ap
我已经用GraphQL安装了我的。一旦我启动了新的项目,并按照graphql的设置使用了react本机,我就得到了这个错误。
ApolloProvider没有被传递给客户端实例。确保你通过客户端通过你的客户。
我从上到下一直跟踪这个。
apollo.js
import {HttpLink} from 'apollo-link-http';
import {ApolloClient} from 'apollo-client';
import {InMemoryCache} from 'apollo-cache-inmemory';
con
当我启动我的graphql服务器时,我收到如下错误: This package has been deprecated and now it only exports makeExecutableSchema.
And it will no longer receive updates.
We recommend you to migrate to scoped packages such as @graphql-tools/schema, @graphql-tools/utils and etc.
Check out https://www.graphql-tools.com to lea
我正在使用Apollo客户端,Graphcool和React。我有一个工作的登录表单,但我需要的UI更新时,用户登录,我需要这发生在不同的组件。
看起来apollo-link-state就是这个问题的解决方案。我的下面的代码似乎可以工作,但我得到了这个错误:
writeToStore.js中的Missing field CurrentUserIsLoggedIn in {}
我的Apollo客户端设置:
import React from 'react';
import ReactDOM from 'react-dom';
// Apollo
import {
因此,我正在尝试让Apollo服务器与现有的Meteor项目协同工作。在我的项目目录中,我运行
meteor add apollo
meteor npm install --save apollo-client graphql-server-express express graphql
graphql-tools body-parser
将Apollo添加到我的项目中,并安装我稍后需要的所有依赖项。当我尝试在imports/startup/index.js文件中创建我的Apollo服务器时,我得到以下错误
TypeError: createApolloServer is not a fun
我一直在关注我在谷歌上找到的关于如何制作AuthDirective的所有结果,但我不能让它工作。
我会留下所有的文件,看看我是否在实现上犯了错误,但我猜不是,因为我测试了,即使在field.resolve中没有任何条件。
我发现的一件特别的事情是field.resolve,带有4个参数,第一个参数总是未定义,不确定是否可能是它,只是作为一个额外的提示。
下面是代码:
这是我的typedefs的一部分
directive @isAuthenticated on FIELD_DEFINITION
scalar Date
type User {
id: ID,
name: Str