Created
July 11, 2017 08:08
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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