Open iEricKoh opened 6 years ago
I am trying follow the official doc to use data source in my resolvers. However, there's no field name dataSources exists on context.
dataSources
context
I am wondering if the dataSources is acceptable when I try to register the plugin?
const resolvers = { Query: { product: async (_source: any, args: any, context: any) => { console.log(args) console.log(context) // no dataSources in the context return { id: 1 } } }, };
server.register(graphqlFastify, { prefix: '/graphql', graphql: { schema, dataSources: () => { console.log('The log doesn\'t print') return { productAPI: new ProductAPI(), }; }, context: () => { return { token: 'foo', }; }, tracing: true, cacheControl: { defaultMaxAge: 500, stripFormattedExtensions: false, calculateCacheControlHeaders: false, }, cache: new RedisCache({ host: '127.0.0.1' }) }, });
https://www.apollographql.com/docs/apollo-server/features/data-sources.html
I am trying follow the official doc to use data source in my resolvers. However, there's no field name
dataSources
exists oncontext
.I am wondering if the
dataSources
is acceptable when I try to register the plugin?https://www.apollographql.com/docs/apollo-server/features/data-sources.html