Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
169
rated 0 times [  171] [ 2]  / answers: 1 / hits: 74230  / 7 Years ago, thu, april 6, 2017, 12:00:00

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



Any help will be profoundly appreciated!


More From » node.js

 Answers
18

According to the docs there should be a ctx.request.query that is the query string items represented as an object.


[#58247] Tuesday, April 4, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
micayla

Total Points: 148
Total Questions: 92
Total Answers: 109

Location: Aruba
Member since Sat, Oct 2, 2021
3 Years ago
micayla questions
Fri, Dec 24, 21, 00:00, 2 Years ago
Thu, Apr 16, 20, 00:00, 4 Years ago
Thu, Nov 14, 19, 00:00, 5 Years ago
;