Use body parser only for post requests in koa

This commit is contained in:
Vlad Shcherbin 2017-07-23 16:41:29 +03:00 committed by GitHub
parent 50866dc5ba
commit 943120269c

View file

@ -122,9 +122,7 @@ const router = new koaRouter();
const PORT = 3000;
// koaBody is needed just for POST.
app.use(koaBody());
router.post('/graphql', graphqlKoa({ schema: myGraphQLSchema }));
router.post('/graphql', koaBody(), graphqlKoa({ schema: myGraphQLSchema }));
router.get('/graphql', graphqlKoa({ schema: myGraphQLSchema }));
app.use(router.routes());