question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dataSources option for rest apis

See original GitHub issue

Is there any way I can provide dataSources for rest apis

e.g With ApolloServer it can be done as -

const server = new ApolloServer({
  typeDefs,
  resolvers,
  dataSources: () => {
    return {
      moviesAPI: new MoviesAPI(),
      personalizationAPI: new PersonalizationAPI(),
    };
  },
  context: () => {
    return {
      token: 'foo',
    };
  },
});

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:9
  • Comments:10

github_iconTop GitHub Comments

6reactions
kesonseekcommented, Nov 5, 2019

Can pass through context

const server = new ApolloServer({
  typeDefs,
  resolvers,
  context: () => ({
   dataSources: () => {
    return {
      moviesAPI: new MoviesAPI(),
      personalizationAPI: new PersonalizationAPI(),
    };
  },
  }),
});
2reactions
marcimmediatocommented, Jan 30, 2019

Looking for a way to use apollo-datasource-rest with graphql-yoga. I don’t think there’s the interface for integration. Anyone knows something…?

@japboy seems like this is not possible with Yoga. I wound up switching my server to Apollo Server 2 so I could use it.

Sent with GitHawk

Read more comments on GitHub >

github_iconTop Results From Across the Web

Guide to REST API data sources and data feeds
Guide to REST API data sources and data feeds · How to read an API query · Example API queries · Supported query...
Read more >
Fetching from REST - Apollo GraphQL Docs
The RESTDataSource class simplifies fetching data from REST APIs and helps handle caching, deduplication, and errors while resolving operations.
Read more >
REST Datasource - Tyk.io
The REST Datasource is a base component of UDG to help you add existing REST APIs to your data graph. By attaching a...
Read more >
Data Sources Methods - Tableau Help
Using the data sources methods of the Tableau Server REST API you can: Publish, update metadata, delete, or refresh the extract of a...
Read more >
RESTful Data Source Options - Logi Analytics
JReport Engine will use the REST Web Service Client API (such as the JAX-RS client API of Java EE) to get remote data...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found