refactor: changed context to contain just req,res and connection objects for GraphQLModule

This commit is contained in:
Balu Babu
2023-02-08 14:27:24 +05:30
parent 1ad11adb94
commit 0aac046a0e

View File

@@ -34,21 +34,11 @@ import { UserHistoryModule } from './user-history/user-history.module';
},
},
},
context: async ({ req, connection }) => {
if (req) {
return { reqHeaders: req.headers };
} else {
return {
// Lowercase the keys
reqHeaders: Object.fromEntries(
Object.entries(connection.context).map(([k, v]) => [
k.toLowerCase(),
v,
]),
),
};
}
},
context: ({ req, res, connection }) => ({
req,
res,
connection,
}),
driver: ApolloDriver,
}),
UserModule,