Previously I was using apollo-server-express and I wanted to migrate to fastify so I change it to apollo-server-fastify. But it started giving lots of issues.
One of such issue is - Not able to access res object from context function.
Below code was working perfectly but res object itself was not available with apollo-server-fastify
context: async ({ req, res, connection }) => {
// res <--------- undefined
if (connection) {
return {
models,
}
}
if (req) {
const me = await getMe(req, res)
return {
models,
me,
secret: process.env.SECRET,
}
}
},
Previously I was using
apollo-server-expressand I wanted to migrate to fastify so I change it toapollo-server-fastify. But it started giving lots of issues.One of such issue is - Not able to access
resobject from context function.Below code was working perfectly but res object itself was not available with
apollo-server-fastify