CartoDB-SQL-API/lib/api/middlewares/formatter.js

15 lines
328 B
JavaScript
Raw Normal View History

2019-07-27 01:22:26 +08:00
'use strict';
const formats = require('../../models/formats');
2019-07-27 01:22:26 +08:00
module.exports = function formatter () {
return function formatterMiddleware (req, res, next) {
const { format } = res.locals.params;
const FormatClass = formats[format];
req.formatter = new FormatClass();
next();
};
};