Implement sequence/get API endpoint.

It returns data for all individual points in a sequence.
This commit is contained in:
D. Berge
2021-09-04 18:04:52 +02:00
parent 8d3b7adc78
commit 45fe467a21
7 changed files with 194 additions and 127 deletions

View File

@@ -0,0 +1,23 @@
const json = require('./json');
const geojson = require('./geojson');
module.exports = async function (req, res, next) {
try {
const handlers = {
"application/json": json,
"application/geo+json": geojson,
};
const mimetype = (handlers[req.query.mime] && req.query.mime) || req.accepts(Object.keys(handlers));
if (mimetype) {
res.set("Content-Type", mimetype);
await handlers[mimetype](req, res, next);
} else {
res.status(406).send();
next();
}
} catch (err) {
next(err);
}
}