Skip to content

Commit 526c1d4

Browse files
committed
switch back to default koa cors
1 parent 0c55fe1 commit 526c1d4

File tree

4 files changed

+4
-13
lines changed

4 files changed

+4
-13
lines changed

package-lock.json

Lines changed: 0 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: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"@koa/cors": "^2.2.1",
3131
"koa": "^2.5.0",
3232
"koa-compress": "^2.0.0",
33-
"koa-cors": "0.0.16",
3433
"koa-helmet": "^3.3.0",
3534
"koa-json": "^2.0.2",
3635
"koa-logger": "^3.2.0",

src/app.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ const cache = require('koa-redis-cache');
44
const options = require('./db/redis');
55
const compress = require('koa-compress');
66
const logger = require('koa-logger');
7-
const cors = require('koa-cors');
87
const helmet = require('koa-helmet');
98
const MongoClient = require('mongodb');
9+
const cors = require('@koa/cors');
1010
const json = require('koa-json');
1111

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

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

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

test/routes/v2-capsules.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ test('It should return Dragon data', async () => {
5050
// Individual Capsule V2
5151
//------------------------------------------------------------
5252

53-
test('It should return all v2 capsules', async () => {
54-
const response = await request(app.callback()).get('/v2/capsules');
53+
test('It should return dragon1 capsule', async () => {
54+
const response = await request(app.callback()).get('/v2/capsules/dragon1');
5555
expect(response.statusCode).toBe(200);
5656
});

0 commit comments

Comments
 (0)