use body-parser
module so just try in index file
const bodyParser = require("body-parser");
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
and in router file :
let item : string[]= JSON.parse(req.query.sort);
let object = {}
object[item[0]] = item[1];
const users = await User.find({}).sort(object)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…