You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
// 添加统一的返回结果方法
|
|
module.exports = function(req, res, next){
|
|
res.sendResult = function(data,code,message) {
|
|
var fmt = req.query.fmt ? req.query.fmt : "rest";
|
|
if(fmt == "rest") {
|
|
res.json(
|
|
{
|
|
"data" : data,
|
|
"meta" : {
|
|
"msg" : message,
|
|
"status" : code
|
|
}
|
|
});
|
|
}
|
|
};
|
|
next();
|
|
} |