Routing with query params

I want to use a route and then parse query params. I can not switch to kirbys params using the colon notion.
it does not work using (:all). how to set this up?

url example : http://mypage.com/api/redirect/?code=CODE
route pattern: api/redirect/(:all)

then inside the route, doing something like $__GET

parse_str(parse_url($all, PHP_URL_QUERY), $getValues);
$code = a::get($getValues, 'code');

sadly this post did not help me…

nevermind.solved it.

route pattern: api/redirect

parse_str(parse_url(server::get('request_uri'), PHP_URL_QUERY), $getValues);
$code = a::get($getValues, 'code');

Or simply get('code') should work as well in a route.

2 Likes