koa request parameter acquisition

In koa, we use to ctx.paramsobtain the request parameters in the url path, use to ctx.queryobtain the query string parameters behind?, and use to ctx.headersobtain headers
Insert picture description here
because it is configured in app.js, which koa-bodyparser
Insert picture description here
can be used to ctx.request.bodyobtain the json parameters passed by the post.

Make a breakpoint and send the request with postman.
Insert picture description here
Insert picture description here
Result:
Insert picture description here

Guess you like

Origin blog.csdn.net/dyw3390199/article/details/114106521