From b85dcb474f2abf1bfe537ef6f24e4622b0e357ac Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Fri, 2 Nov 2018 22:51:05 +0100 Subject: [PATCH] Adding the context configuration to apollo server --- server/src/app.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/src/app.js b/server/src/app.js index 2a53b0250..5dfc2d97c 100644 --- a/server/src/app.js +++ b/server/src/app.js @@ -29,6 +29,10 @@ const server = new ApolloServer({ 'editor.cursorShape': 'line', }, }, + context: ({ req }) => ({ + userId: req.headers.userid, + authorization: req.headers.authorization, + }), formatError: error => ({ code: error.extensions.exception.code, message: error.message,