Created
June 12, 2019 18:11
Simple example app.js
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
const graphqlSettingsPerReq = async req => { | |
const { user } = await getUser(req.header.authorization); | |
return { | |
graphiql: process.env.NODE_ENV !== 'production', | |
schema, | |
context: { | |
user, | |
req, | |
dataloaders, | |
}, | |
formatError: error => { | |
console.log(error.message); | |
console.log(error.locations); | |
console.log(error.stack); | |
return { | |
message: error.message, | |
locations: error.locations, | |
stack: error.stack, | |
}; | |
}, | |
} | |
} | |
// Iniciamos um no server GraphQL | |
const graphqlServer = GraphQLHTTP(graphqlSettingsPerReq) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment