How to get koa-router query params?

Basically, I think you misunderstood context.params and query string.

I assume that you are using koa-router. With koa-router, a params object is added to the koa context, and it provides access to named route parameters. For example, if you declare your route with a named parameter id, you can access it via params:

router.get('/delete/:id', (ctx, next) => {
  console.log(ctx.params);
  // => { id: '[the id here]' }
});  

To get the query string pass through the HTTP body, you need to use ctx.request.query, which ctx.request is koa request object.

Another thing you should be aware with your code is essentially, a http delete request is not recommended to have a body, which mean you should not pass a params with it.

Tags:

Node.Js

Koa2