How does koa put co data into the responder and return it to the front desk?

  node.js, question

Let me ask you a question. I just got in touch with koa and wanted to use co and generator for asynchronization, but I found that I couldn’t let the request wait for the asynchronous request to return data and the request responded directly.
Js routing code

The following is the business code. I want to return the data to body inside, but I can’t wait for the data to return, and then I will respond.

Well, with koa, you don’t have to manually write co yourself, do it

module.exports.getPackages = function *getPackages(){
 var userVersionNum =   ...
 this,body = yield versionOperation.getLastVersion()

There are still some things that I don’t understand. I can refer to my practice of this small item. I have used this one.