Files
talk/graph/index.js
T
2017-01-19 18:26:33 -07:00

25 lines
492 B
JavaScript

const loaders = require('./loaders');
const mutators = require('./mutators');
const schema = require('./schema');
module.exports = {
createGraphOptions: (req) => {
let context = {};
// Load the current logged in user to `user`, otherwise this'll be null.
context.user = req.user;
// Create the loaders.
context.loaders = loaders(context);
// Create the mutators.
context.mutators = mutators(context);
return {
schema,
context
};
}
};