From 1ab4d7385c48e1c44eb973d0161bb1b45385b8ae Mon Sep 17 00:00:00 2001 From: Miguel Angel Flores Date: Wed, 28 Mar 2018 11:50:51 +0200 Subject: [PATCH 1/2] enable cors --- lib/http/index.js | 4 +++- package.json | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/http/index.js b/lib/http/index.js index a9325ba8..e85c9a75 100755 --- a/lib/http/index.js +++ b/lib/http/index.js @@ -20,7 +20,8 @@ var app = express() , pug = require('pug') , json = require('./routes/json') , util = require('util') - , nib = require('nib'); + , nib = require('nib') + , cors = require('cors'); // expose the app @@ -47,6 +48,7 @@ app.locals = { inspect: util.inspect }; app.use(stylus.middleware({ src: __dirname + '/public', compile: compile })); app.use(express.static(__dirname + '/public')); +app.use('*', cors()); // JSON api diff --git a/package.json b/package.json index 9621ed20..4d3c186f 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ }, "dependencies": { "body-parser": "^1.12.2", + "cors": "^2.8.4", "express": "^4.12.2", "lodash": "^4.0.0", "nib": "~1.1.2", From d15655d4dffe889d989b352d3107f8f8db030cfe Mon Sep 17 00:00:00 2001 From: Miguel Angel Flores Date: Wed, 28 Mar 2018 12:10:02 +0200 Subject: [PATCH 2/2] own npmjs entry --- package.json | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 4d3c186f..36d4402c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "kue", + "name": "kue-cors", "version": "0.11.5", - "description": "Feature rich priority job queue backed by redis", + "description": "Feature rich priority job queue backed by redis with CORS enabled", "homepage": "http://automattic.github.io/kue/", "keywords": [ "job", @@ -15,14 +15,18 @@ { "name": "Behrad Zari", "email": "behradz@gmail.com" + }, + { + "name": "Miguel Angel Flores", + "email": "supermafete@gmail.com" } ], "repository": { "type": "git", - "url": "https://github.com/Automattic/kue.git" + "url": "https://github.com/supermafete/kue-cors" }, "bugs": { - "url": "https://github.com/Automattic/kue/issues" + "url": "https://github.com/supermafete/kue-cors/issues" }, "dependencies": { "body-parser": "^1.12.2",