CartoDB-SQL-API/app/middlewares/formatter.js
2019-07-26 19:22:26 +02:00

15 lines
325 B
JavaScript

'use strict';
const formats = require('../models/formats');
module.exports = function formatter () {
return function formatterMiddleware (req, res, next) {
const { format } = res.locals.params;
const FormatClass = formats[format];
req.formatter = new FormatClass();
next();
};
};