forked from NANDAWEN/fastify-apollo
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
I am trying follow the official doc to use data source in my resolvers.
However, there's no field name dataSources exists on 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels