sepia-search-motore-di-rice.../server/middlewares/sort.ts

15 lines
344 B
TypeScript
Raw Normal View History

2020-02-13 11:49:03 +01:00
import * as express from 'express'
import 'express-validator'
function setDefaultSort (req: express.Request, res: express.Response, next: express.NextFunction) {
if (!req.query.sort) req.query.sort = '-createdAt'
return next()
}
// ---------------------------------------------------------------------------
export {
setDefaultSort
}