express-mockjs
express-mockjs copied to clipboard
模板里面 可以加上除了Url之外的 type这类的额嘛
@url @type
url 是当前请求地址吗? type 是请求方法吗?
module.exports = function (req) {
// express 的 req 对象
return {
"method": req.method, // 请求方法
"url": req.url, // pathname + querystring
"path": req.path, // pathname
"name": "@cname",
"email": "@email",
"date": "@date",
};
};
可以这样实现,如果你想直接 json 调用,我抽空给他加上。
对 这样会更灵活