From 4409c90979df6ffd38860a5e8aff5f13284d5f97 Mon Sep 17 00:00:00 2001 From: fenwick67 Date: Sun, 9 Sep 2018 16:28:19 -0500 Subject: [PATCH] add CORS stuff so it works --- index.js | 4 +++- package-lock.json | 9 +++++++++ package.json | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index e8c8fe3..38d45be 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,7 @@ var Express = require('express'); var convert = require('./lib/convert'); var serveStatic = require('serve-static'); var request = require('request'); +var cors = require('cors'); var log = console.log; var app = Express(); @@ -23,7 +24,8 @@ app.use( }) ); -app.get('/api/feed',function(req,res){ +app.options('/api/feed',cors()); +app.get('/api/feed',cors(),function(req,res){ // get feed url var feedUrl = req.query.url; diff --git a/package-lock.json b/package-lock.json index 77a4000..9e670bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -504,6 +504,15 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, + "cors": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", + "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, "cross-spawn": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-3.0.1.tgz", diff --git a/package.json b/package.json index f43ffea..5775e12 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "dependencies": { + "cors": "^2.8.4", "ejs": "^2.5.6", "express": "^4.16.3", "feedparser": "^2.2.0",