1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
'use strict' const sortMiddleware = { setVideosSort: setVideosSort } function setVideosSort (req, res, next) { if (!req.query.sort) req.query.sort = '-createdDate' return next() } // --------------------------------------------------------------------------- module.exports = sortMiddleware