Skip to content

Commit a632b8e

Browse files
committed
Switched from koa-json-filter to koa-json-mask to allow for nested json filtering
1 parent bcb0753 commit a632b8e

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

package-lock.json

Lines changed: 13 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
@@ -32,14 +32,14 @@
3232
},
3333
"homepage": "https://github.com/r-spacex/SpaceX-API",
3434
"dependencies": {
35-
"@koa/json-filter": "^1.0.0",
3635
"cheerio": "^1.0.0-rc.2",
3736
"fuzzball": "^1.1.5",
3837
"koa": "^2.5.3",
3938
"koa-bodyparser": "^4.2.1",
4039
"koa-compress": "^3.0.0",
4140
"koa-helmet": "^4.0.0",
4241
"koa-is-json": "^1.0.0",
42+
"koa-json-mask": "^1.0.0",
4343
"koa-logger": "^3.2.0",
4444
"koa-morgan": "^1.0.1",
4545
"koa-redis-cache": "^3.0.2",

src/app.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ const cache = require('koa-redis-cache');
44
const compress = require('koa-compress');
55
const cors = require('koa2-cors');
66
const helmet = require('koa-helmet');
7-
const jsonFilter = require('@koa/json-filter');
87
const Koa = require('koa');
98
const logger = require('koa-morgan');
9+
const mask = require('koa-json-mask');
1010
const MongoClient = require('mongodb');
1111
const json = require('./middleware/json');
1212
const options = require('./middleware/redis');
@@ -97,7 +97,9 @@ if (process.env.NODE_ENV === 'production') {
9797
}
9898

9999
// Allow user to restrict the keys returned
100-
app.use(jsonFilter());
100+
app.use(mask({
101+
name: 'filter',
102+
}));
101103

102104
// Allow pretty print via pretty=true querystring
103105
// Pretty printed json will NOT be cached

0 commit comments

Comments
 (0)