var ccap = require('ccap')();//验证码 //获取验证码 exports.userCode = function(req, res){ if(res.url == '/favicon.ico')return res.end('');//Intercept request favicon.ico var ary = ccap.get(); var txt = ary[0]; var buf = ary[1].toString('base64'); req.session.userCode = txt res.json({pic:buf}) }