add CORS stuff so it works

This commit is contained in:
fenwick67 2018-09-09 16:28:19 -05:00
parent 648ce55b47
commit 4409c90979
3 changed files with 13 additions and 1 deletions

View file

@ -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;

9
package-lock.json generated
View file

@ -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",

View file

@ -1,5 +1,6 @@
{
"dependencies": {
"cors": "^2.8.4",
"ejs": "^2.5.6",
"express": "^4.16.3",
"feedparser": "^2.2.0",