Skip to content

Commit

Permalink
Set up CORS
Browse files Browse the repository at this point in the history
  • Loading branch information
getogrand committed May 7, 2017
1 parent 911bfa6 commit 702f989
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const express = require('express')
const morgan = require('morgan')
const cookieParser = require('cookie-parser')
const bodyParser = require('body-parser')
const cors = require('cors')
const mongoose = require('mongoose')
const config = require('config')
const winston = require('winston')
Expand Down Expand Up @@ -37,6 +38,7 @@ if (config.useMorgan) {
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))
app.use(cookieParser())
app.use(cors({ origin: config.corsOrigin }))

app.use('/api/', mails)

Expand Down
1 change: 1 addition & 0 deletions config/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ module.exports = {
logLevel: 'debug',
slackErrorLogging: false,
useMorgan: true,
corsOrigin: '*',
}
1 change: 1 addition & 0 deletions config/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ module.exports = {
logLevel: 'info',
slackErrorLogging: true,
useMorgan: true,
corsOrigin: 'https://sh8.email',
}
1 change: 1 addition & 0 deletions config/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ module.exports = {
logLevel: 'debug',
slackErrorLogging: false,
useMorgan: false,
corsOrigin: '*',
}

0 comments on commit 702f989

Please sign in to comment.