Give us a second

ANY route

Routing for any HTTP method

ANY route (GET, POST ... others)

At some point your web application will need to support any type of HTTP request. It usually happens on the page not found since, regardless the request (GET, POST, any other), the system should be able to display the propper message to the user to let him/her know that the page is not in the system.

To make it simple and intuitive, the library has the any function. The route must be /404 and the file that contains the page can be called anything and can be placed under any folder like in the following example:


any('/404', 'views/404.php')

Note that this route will work for any request.

Does ANY work with AJAX/FETCH ?

Yes, but you will have to code it. It means that the any route will point to a file of your choice, but it doesn't know if the request is a normal HTTP or AJAX call. So in the file, you will have to detect it.

Since there is no default detection method for AJAX/FETCH at the server, you will have to design your application and choose the best technique to figure if the request is AJAX or Fetch

Can I change "/404" ?

The library is designed to use any with the route /404, but you can change it. It doesn't make sence that you will want something like this, though if really needed, define the new route to something like /not-found and make sure that you change the code in the router.php file by replacing the /404 to /not-found.