We can't directly return a value in koa, so the front-end can't get this value
We need to mount the value (mostly json in actual development) ctx.body
, so that the front end can get the data.
If we return an object, koa will automatically convert this object into a json object and add it to the Response HeadersContent-Type: application/json
koa-router
The use of koa-router can be divided into these three steps: