Ctx.body cannot receive content in koa2

ctx.body = await service.get_search_data(start,count,keyword,(err,res)=>{
    if(err){
        return "";
    }else {
        return res;
        }
    }
)
The res in the

callback function can accept the data, so why can"t the ctx.body accept it?

Feb.28,2021

ctx.body = await new Promise((resolve, reject) => {
  service.get_search_data(start, count, keyword, (err, res) => err ? reject(err) : resolve(res))
})
Menu