Comments (3)
In AS4 there's no longer any magic around how data sources are created. In v3 as you've pointed out, the server cache (and context) were shared with your data sources automatically.
The migration guide explains how to replicate this old behavior if you like:
https://www.apollographql.com/docs/apollo-server/migration/#datasources
Does that approach fix the issue for you?
I'm not sure the caching docs that you linked to need to concern themselves with RESTDataSource
. Maybe the README should mention the cache
configuration option and show the migration path?
from datasource-rest.
The caching docs it's not up to date because if I only do what it says, the caching doesn't work
import Keyv from "keyv";
import { KeyvAdapter } from "@apollo/utils.keyvadapter";
const server = new ApolloServer({
typeDefs,
resolvers,
cache: new KeyvAdapter(new Keyv("redis://user:pass@localhost:6379")),
});
I have to do the behavior in https://www.apollographql.com/docs/apollo-server/migration/#datasources
Thanks for the response
from datasource-rest.
@dycor right. What I'm saying is: the article you're linking to is not specific to RESTDataSource
(or any data source for that matter). That article pertains to configuring the server's cache. If you choose to share that cache with data sources, that's a different concern. Maybe something we could document here?
from datasource-rest.
Related Issues (20)
- Document `contextValue` recipe for circular references in context object
- Posting FormData as body (for file uploads) not possible anymore HOT 7
- Forward all cache options to key value cache HOT 6
- Unable to connect to Localhost server HOT 1
- @apollo/datasource-rest willSendRequest param type missing `agent` HOT 7
- Feature request: More control over readResponseAndWriteToCache method HOT 4
- Why the introduction of response.clone() in HTTPCache class? HOT 4
- Refine `Content-Type` negotiation
- Add url as an argument to the RESTDataSource.didEncounterError() function
- Make errorFromResponse parameters optional
- Parse blob data HOT 1
- RequestDeduplicationPolicy is not exported in datasource-rest index.ts
- Fix CacheOptions Related Types HOT 1
- Typescript project build failing due to missing type declarations HOT 1
- Unable to prevent reading from the Cache HOT 3
- Question about cacheOptions HOT 1
- 304 throws if last-modified doesn't match across requests
- HELP: Proper way to set http proxy HOT 1
- "DeprecationWarning: The `punycode` module is deprecated." in Node 22 HOT 2
- JSON body is not parsed when Content-Type contains a charset
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datasource-rest.