一段代码爱上express

router.get('/test', function(req, res, next) {
    sqlQuery("select * from userinfo", (data) => {
        let type2num = {}
        data.forEach(({ id, type, num }) => {
            if (type2num[type])
                type2num[type] += num
            else
                type2num[type] = num
        })
        res.send({
            code: "200",
            message: "查询成功",
            data,
            type2num,
        });
    });
});

相关文章

根据官网 入门 express
java叫接口control什么的app.get.post等等都是请求方式我们可...
为了前端丢进去的时候可以直接判断中间件就是经过了这个就会...
Express 文件的上传和下载
运行命令下载app.js 增加中间件。
基本模板来的 后面用后就有什么加什么都行。