TypeError: res.send is not a function

999 阅读1分钟

​TypeError: res.send is not a function

按网上的说法是 

change first param res to req:

就是(req,res)写反了,写成(res,req),改回来就好了

但是呢,我是这个出问题了

请求返回的res 和res.send中的res重名了,系统分辨不出来,出错代码为

   let res= await setUserInfo(user_id, age, sex, job, path, birthday);
 if (res.length) {
      res.send({
        code: 200,
        data: res[0],
      });

res改回result就好了