Adding the context configuration to apollo server

This commit is contained in:
Nikola Bjelo committed 2018-11-02 22:51:05 +01:00
1 parent fa02ee7593
commit b85dcb474f
1 file changed
+4
+4
View File
@@ -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,