diff --git a/lib/stations.js b/lib/stations.js index 585ab12..6d1d5fe 100644 --- a/lib/stations.js +++ b/lib/stations.js @@ -4,6 +4,7 @@ const autocomplete = require('db-stations-autocomplete') const stations = require('db-stations') const parse = require('cli-native').to const createFilter = require('db-stations/create-filter') +const filterStream = require('stream-filter') const ndjson = require('ndjson') const err400 = (msg) => { @@ -31,7 +32,7 @@ const filter = (req, res, next) => { stations.full() .on('error', next) - .pipe(filter) + .pipe(filterStream.obj(filter)) .on('error', next) .pipe(ndjson.stringify()) .on('error', next) diff --git a/package.json b/package.json index ce7b3d2..2c3e0e4 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,8 @@ "hafas-client": "^2.0.0-alpha.3", "hafas-rest-api": "0.1.0-alpha.2", "hsts": "^2.1.0", - "ndjson": "^1.5.0" + "ndjson": "^1.5.0", + "stream-filter": "^2.1.0" }, "scripts": { "start": "node index.js"