parent
04f2d5d9c2
commit
40865154fa
1 changed files with 4 additions and 5 deletions
|
@ -49,7 +49,6 @@ const complete = (req, res, next, q, allStations, onStation, onEnd) => {
|
||||||
const completion = parse(q.completion) !== false
|
const completion = parse(q.completion) !== false
|
||||||
const results = autocomplete(q.query, limit, fuzzy, completion)
|
const results = autocomplete(q.query, limit, fuzzy, completion)
|
||||||
|
|
||||||
const data = []
|
|
||||||
for (const result of results) {
|
for (const result of results) {
|
||||||
const station = allStations[result.id]
|
const station = allStations[result.id]
|
||||||
if (!station) continue
|
if (!station) continue
|
||||||
|
@ -96,7 +95,7 @@ const stationsRoute = (req, res, next) => {
|
||||||
pAllStations
|
pAllStations
|
||||||
.then(({stations, timeModified, asJson, asNdjson}) => {
|
.then(({stations, timeModified, asJson, asNdjson}) => {
|
||||||
res.setHeader('Last-Modified', timeModified.toUTCString())
|
res.setHeader('Last-Modified', timeModified.toUTCString())
|
||||||
if (Object.keys(req.query).length === 0) {
|
if (Object.keys(q).length === 0) {
|
||||||
const data = t === JSON_MIME ? asJson.data : asNdjson.data
|
const data = t === JSON_MIME ? asJson.data : asNdjson.data
|
||||||
const etag = t === JSON_MIME ? asJson.etag : asNdjson.etag
|
const etag = t === JSON_MIME ? asJson.etag : asNdjson.etag
|
||||||
serveBuffer(req, res, data, {timeModified, etag})
|
serveBuffer(req, res, data, {timeModified, etag})
|
||||||
|
@ -151,12 +150,12 @@ Instead of receiving a JSON response, you can request [newline-delimited JSON](h
|
||||||
}],
|
}],
|
||||||
responses: {
|
responses: {
|
||||||
'2XX': {
|
'2XX': {
|
||||||
description: 'An array of stops/stations, in the [`db-stations@3` format](https://github.com/derhuerst/db-stations/blob/3.0.1/readme.md).',
|
description: 'An object of stops/stations in the [`db-stations@3` format](https://github.com/derhuerst/db-stations/blob/3.0.1/readme.md), with their IDs as the keys.',
|
||||||
content: {
|
content: {
|
||||||
'application/json': {
|
'application/json': {
|
||||||
schema: {
|
schema: {
|
||||||
type: 'array',
|
// todo
|
||||||
items: {type: 'object'}, // todo
|
type: 'object',
|
||||||
},
|
},
|
||||||
// todo: example(s)
|
// todo: example(s)
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue