Skip to content

Instantly share code, notes, and snippets.

@smooJitter
Created July 11, 2017 08:08
Show Gist options
  • Save smooJitter/c7fd92d4167a13eacf3e0c4e9d04ca0e to your computer and use it in GitHub Desktop.
Save smooJitter/c7fd92d4167a13eacf3e0c4e9d04ca0e to your computer and use it in GitHub Desktop.
This should make it possible to forward meteor.user account profile to the guru graphql ide
/*
* GraphQL rourte
*/
'use strict';
import { graphqlExpress } from 'graphql-server-express';
import { makeExecutableSchema } from 'graphql-tools';
import { parse } from 'graphql';
import { schema, resolvers } from '../modules/ide/index-ide';
export default function ideRoute({ app, context }) {
const logger = { log: e => console.log(e) };
app.route('/ide/schema').get((req, res) => res.json(parse(schema)));
app.use(
'/ide',
graphqlExpress(req => {
// parse persistent query against schema
return {
// // GraphiQL options (default: log the current user in your request)
passHeader: "'meteor-login-token': localStorage['Meteor.loginToken']",
schema: makeExecutableSchema({
typeDefs: schema,
resolvers,
logger,
}),
context: {
...context,
req,
},
};
})
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment