I'm using koa-router.
How can I get the request's query string params?
This is the best I managed to write:
import koaRouter from 'koa-router'; const router = koaRouter({ prefix: '/courses' }); router.get('/', async (ctx) => { console.log(ctx.qs["lecturer"]); });
but qs is undefined
qs
Any help will be profoundly appreciated!
According to the docs there should be a ctx.request.query that is the query string items represented as an object.
ctx.request.query
2.1m questions
2.1m answers
60 comments
57.0k users