Skip to content

Commit d0d5a79

Browse files
committed
switched to a working version of cors
1 parent 526c1d4 commit d0d5a79

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
},
2828
"homepage": "https://github.com/r-spacex/SpaceX-API",
2929
"dependencies": {
30-
"@koa/cors": "^2.2.1",
3130
"koa": "^2.5.0",
3231
"koa-compress": "^2.0.0",
3332
"koa-helmet": "^3.3.0",
@@ -36,6 +35,7 @@
3635
"koa-redis-cache": "^3.0.0",
3736
"koa-respond": "^1.0.1",
3837
"koa-router": "^7.4.0",
38+
"koa2-cors": "^2.0.5",
3939
"lower-case": "^1.1.4",
4040
"mongodb": "^3.0.4",
4141
"path": "^0.12.7"

src/app.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const compress = require('koa-compress');
66
const logger = require('koa-logger');
77
const helmet = require('koa-helmet');
88
const MongoClient = require('mongodb');
9-
const cors = require('@koa/cors');
9+
const cors = require('koa2-cors');
1010
const json = require('koa-json');
1111

1212
const home = require('./v2-routes/v2-home');
@@ -30,7 +30,9 @@ app.use(compress());
3030
app.use(helmet());
3131

3232
// Enable CORS for all routes
33-
app.use(cors());
33+
app.use(cors({
34+
origin: '*',
35+
}));
3436

3537
// Add pretty output option for debugging
3638
app.use(json({ pretty: false, param: 'pretty' }));

0 commit comments

Comments
 (0)