mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-12 13:28:32 +03:00
add cors in development
This commit is contained in:
@@ -4,8 +4,8 @@
|
|||||||
"description": "Starter project for an ES6 RESTful Express API",
|
"description": "Starter project for an ES6 RESTful Express API",
|
||||||
"main": "dist",
|
"main": "dist",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "nodemon -w src --exec \"babel-node src\"",
|
"dev": "NODE_ENV=development nodemon -w src --exec \"babel-node src\"",
|
||||||
"build": "npx babel src -d dist",
|
"build": "NODE_ENV=production npx babel src -d dist",
|
||||||
"start": "node dist",
|
"start": "node dist",
|
||||||
"lint": "standard \"src/**/*.js\" \"test/**/*/js\"",
|
"lint": "standard \"src/**/*.js\" \"test/**/*/js\"",
|
||||||
"test-watch": "ava --watch",
|
"test-watch": "ava --watch",
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"body-parser": "^1.13.3",
|
"body-parser": "^1.13.3",
|
||||||
"compression": "^1.5.2",
|
"compression": "^1.5.2",
|
||||||
"cors": "^2.7.1",
|
"cors": "^2.8.5",
|
||||||
"express": "^4.13.3",
|
"express": "^4.13.3",
|
||||||
"express-graphql": "^0.6.12",
|
"express-graphql": "^0.6.12",
|
||||||
"googleapis": "^32.0.0",
|
"googleapis": "^32.0.0",
|
||||||
|
|||||||
@@ -8,6 +8,13 @@ import config from './config'
|
|||||||
let app = express()
|
let app = express()
|
||||||
app.server = http.createServer(app)
|
app.server = http.createServer(app)
|
||||||
|
|
||||||
|
// enable cross origin requests explicitly in development
|
||||||
|
if (process.env.NODE_ENV === 'development') {
|
||||||
|
const cors = require('cors')
|
||||||
|
console.log('Enabling CORS in development...')
|
||||||
|
app.use(cors())
|
||||||
|
}
|
||||||
|
|
||||||
initialize(controller => {
|
initialize(controller => {
|
||||||
app.use(
|
app.use(
|
||||||
middleware({
|
middleware({
|
||||||
|
|||||||
@@ -1267,9 +1267,9 @@ core-util-is@~1.0.0:
|
|||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
|
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
|
||||||
|
|
||||||
cors@^2.7.1:
|
cors@^2.8.5:
|
||||||
version "2.8.4"
|
version "2.8.5"
|
||||||
resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.4.tgz#2bd381f2eb201020105cd50ea59da63090694686"
|
resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29"
|
||||||
dependencies:
|
dependencies:
|
||||||
object-assign "^4"
|
object-assign "^4"
|
||||||
vary "^1"
|
vary "^1"
|
||||||
|
|||||||
Reference in New Issue
Block a user