Closed rasmushjulskov closed 7 years ago
Looks like the Header example is on the client, not server?
I haven't tried it, but this might work?
http://dev.apollodata.com/core/meteor.html#meteorClientConfig
const config = meteorClientConfig()
config.networkInterface.use([{
applyMiddleware(req, next) {
// header stuff
}
}]);
const client = new ApolloClient(config)
Hey @Rhjulskov!
As @lorensr pointed out, you can access the request from the client with a custom middleware: http://dev.apollodata.com/core/network.html#networkInterfaceMiddleware
And if you want to do stuff on the request server-side, you can use configServer
config of the createApolloServer
function:
createApolloServer({
schema,
}, {
configServer: expressServer => expressServer.use((req, res, next) => {
// do something there manually or use an express middleware instead of this custom function
}),
});
I'm having this issues when following the Header example from: http://dev.apollodata.com/react/auth.html.
I don't seem to have the same options for accessing the Req in the context in createApolloServer?