Fix matching prefix for api routes

Hey mate!, I've fixed the prefix it was matching anything at the start of the string and it was causing 404s on the api routes. Also made a test on it.

I hope it helps, let me know! ;)