express-mockjs icon indicating copy to clipboard operation
express-mockjs copied to clipboard

模板里面 可以加上除了Url之外的 type这类的额嘛

Open OSMeteor opened this issue 7 years ago • 3 comments

OSMeteor avatar May 26 '18 15:05 OSMeteor

@url @type

OSMeteor avatar May 26 '18 15:05 OSMeteor

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 调用,我抽空给他加上。

52cik avatar May 29 '18 12:05 52cik

对 这样会更灵活

OSMeteor avatar May 30 '18 17:05 OSMeteor