Advertisement
Guest User

Untitled

a guest
Jun 16th, 2020
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. const morgan = require('morgan');
  2.  
  3. morgan.token('graphql-query', req => {
  4. const { query, variables, operationName } = req.body;
  5. if (operationName !== 'IntrospectionQuery') {
  6. return `GRAPHQL: \nOperation Name: ${operationName} \nQuery: ${query} \nVariables: ${JSON.stringify(
  7. variables,
  8. )}`;
  9. }
  10. return true;
  11. });
  12.  
  13. app.use(morgan(':graphql-query'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement