var express = require("express");
var router = express.Router();
var art_handler = require("../controllers/artcate");
router.get("/cates", art_handler.getArticleClassification);
module.exports = router;
var db = require("../utils/db");
exports.getArticleClassification = (req, res) => {
const sql = `select * from ev_article_cate where is_delete =0 order by id asc`;
db.query(sql, (err, results) => {
console.log("2", results);
if (err) return res.cc(err);
res.send({
status: 0,
message: "获取文章分类列表成功",
data: results,
});
});
};
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/7f523889cd46a727d32ee8c3efa88be9.png)
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/81b497ad97d106d2c9c27169e4643a4e.png)