pulling from main

This commit is contained in:
Unknown committed 2019-02-18 12:27:35 +01:00
commit df113ec99f
8 files changed
+105 -103

No files matched your search

+2 -25
View File
@@ -166,8 +166,8 @@ async function run () {
schema,
context,
formatError: error => {
logger.error(`An error ocurred inside a module: ${JSON.stringify(error)}`)
return error
logger.error('An error ocurred inside a module: %s', error.message)
return error.message
},
formatResponse: response => {
logger.debug('Response from Apollo Server: ' + response)
@@ -181,29 +181,6 @@ async function run () {
}
})
const whitelist = [
process.env.PROJECT_SITE_URL,
process.env.PLATFORM_URL,
process.env.GRAPHQL_API_URL,
process.env.TEAMS_API_URL,
process.env.USERS_API_URL,
process.env.EVENTS_API_URL,
process.env.KEYVAULT_API_URL,
process.env.FINANCIAL_BEINGS_API_URL,
process.env.NOTIFICATIONS_API_URL
]
const corsOptionsDelegate = (req, callback) => {
let corsOptions
if (whitelist.indexOf(req.header('Origin')) !== -1) {
corsOptions = { origin: true, credentials: true }
} else {
corsOptions = { origin: false, credentials: true }
}
callback(null, corsOptions)
}
// server.applyMiddleware({ app, cors: corsOptionsDelegate })
server.applyMiddleware({ app, cors: { origin: true, credentials: true, methods:'GET,PUT,POST,DELETE,OPTIONS'}})
app.listen(4100)