// admin/articles.js
router.get('/', async function (req, res, next) {
try {
const condition = {
order: [['id', "DESC"]]
}
const { title } = req.query
if (title) {
condition["where"] = {
title: {
[Op.like]: `%${title}%`
}
}
}
const articles = await Article.findAll(condition);
res.json({
status: true,
message: "查询列表成功。",
data: {
articles
}
});
} catch (error) {
res.status(500).json({
error
})
}
});








网友评论