UNPKG

express-autoroute-json

Version:

Express Auto Route Json is an automatic JSON 'REST' api builder for express-autoroute

17 lines (15 loc) 358 B
var _ = require('lodash'); module.exports = function(options) { return function(req, res, next) { if (options.find && options.find.select) { var fields = options.find.select(req); if (_.isArray(fields)) { fields = fields.join(' '); } _.assign(req, { autorouteSelect: fields, }); } next(); }; };