I wrote a couple of apis for a Deno POC.
This is the route code:
const router = new Router()
router.get('/posts', getPosts)
.get('/posts/:id', getPostsById)
For the second route, I am able to get path param in controller: getPostsById using the keyword: params. This is the controller code:
export const getPostsById = (
{ params, response }: { params:any, response: any }) => {
console.log(params, '||| params')}
How can I get the query param in similar fashion (eg: /posts/2222?userId=3)
I am using oak for routing. I tried various keywords from oak codebase: query, search etc but no success.
I tried getQuery from the Oak documentation as well, but I am completely unable to import it.