Routing and JSON representation

I’m making a website where everything is on the landing page, there is no navigation so far but everyhting is called using JSON and content representation.

so in a way to have no route confusion I made something quite simple so far

        [
            'pattern' => '/(:any)',
            'action'  => function () {
                return go('/', 301);
            }
        ]

but as far as I can see, that is blocking my javascript to access my content representation.

Is there anyway I can deal with that?

Thanks!

(:any) matches any character until the next slash, so will also include your json representation. Use another pattern like alpha or alphanum or a regex pattern as needed, see Routing | Kirby CMS

Thanks texnixe,
I was wondering if there was some way to imply (:any) and have some kind of exception for .json files here…

Yes, as I wrote above, you can use regex patterns, so basically have a pattern that says "any characters but something that includes .json