Routes

Link to the official documentation

The routes can be found in the folder routes. This folder contains a 'Loader.php' file in the root and a subfolder named 'singleton' with
the actual router scripts. A router script is build as a class with the following structure:

<?php
namespace Routes\Singleton;

class Web
{
    function register($app, $container)
    {
       $app->get('/', function ($request, $response) {
            return 'Slim works great';
        });
    }
}

If you create new router scripts you can simply add them to the 'singleton' folder. All scripts in this folder will be loaded automatically.

Be careful not to have the same route redundant in more than one file, otherwise it will lead to unexpected results.

Last update: March 15th at 9:45am