node.js - How to make co in function getByName() return after execution
给我你的怀抱2017-05-16 13:43:20
0
2
750
Determine user login in express (using sequelize and co) However, the information in console.log is only seen after return res. How to make the function in co return after executing it?
UserBil.getByName = () => {
var result = co.wrap(function* (){
return request
// something you want to return
})
return result(true).then(function(value){
return value
})
}
Generally, a Promise is returned, and it must be thened wherever used.