请问有人知道怎么回事吗,我原来在登录页面,想提交用户名密码之后跳到首页 ,但是一直提示TypeError: res.redirect is not a function。这是我写在routes下的js,万分感谢
exports.Login=function*(req,res)
{
let body=req.body;
body.aName=body.aName || '';
body.aPwd=body.aPwd || '';
let rows=yield db.execSQL("select aID,aName from admin where aName=? and aPwd=?",[body.aName,body.aPwd]);
if(rows.length!=1)
return req.session.success = '用户名或密码错误!';
let row=rows[0];
req.session.admin={aID:row.aID,aName:row.aName};
return res.redirect('/首页');
};
相关分类