Skip to content

Commit a7557f7

Browse files
authored
Fixed tutorial code sample (graphql#1632)
* Fixed code sample (graphql#1631) * Fixed format
1 parent 87ff386 commit a7557f7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/pages/graphql-js/authentication-and-express-middleware.mdx

+5-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ function loggingMiddleware(req, res, next) {
2626
}
2727

2828
var root = {
29-
ip(args, request) {
30-
return request.ip
29+
ip(args, context) {
30+
return context.ip
3131
},
3232
}
3333

@@ -38,7 +38,9 @@ app.all(
3838
createHandler({
3939
schema: schema,
4040
rootValue: root,
41-
graphiql: true,
41+
context: req => ({
42+
ip: req.raw.ip,
43+
}),
4244
})
4345
)
4446
app.listen(4000)

0 commit comments

Comments
 (0)