apollo-datasource-graphql | Apollo DataSource to connect to GraphQL API | GraphQL library
kandi X-RAY | apollo-datasource-graphql Summary
kandi X-RAY | apollo-datasource-graphql Summary
GraphQL/Apollo DataSource to connect to GraphQL API's from your Apollo Server
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of apollo-datasource-graphql
apollo-datasource-graphql Key Features
apollo-datasource-graphql Examples and Code Snippets
Community Discussions
Trending Discussions on apollo-datasource-graphql
QUESTION
Edit: Added ARTICLES_QUERY
, tsconfig.json
and package.json
as requested
Edit 2: This works, but it seems an ugly solution. If anyone has a better one I'd be grateful
...ANSWER
Answered 2020-Mar-03 at 14:56There is an open PR in the apollo-datasource-graphql repo: https://github.com/poetic/apollo-datasource-graphql/pull/11
There is a solution which helps you in the meantime. Change your import from:
import { GraphQLDataSource } from 'apollo-datasource-graphql';
to
import { GraphQLDataSource } from 'apollo-datasource-graphql/src';
And finally, I found an interesting part during the research. I found a section in the docs from apollo server where you can define an api as a ressource and not a graphql server. Which is actually the case in your provided code.
In Addition, if you have other issues that might block tsc from compiling, please go under your node_modules into the apollo-datasource-graphql folder and go to the query function. There is the desired type for the options parameter. And as the docs say you need to provide the query you passed as first parameter also in the options as a query like this
const response = await this.query(ARTICLE_QUERY, { query: ARTICLE_QUERY, variables: { id }});
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install apollo-datasource-graphql
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page