public function boot()
    {
        $app = $this;
        $container = $this->getContainer();

        if (is_api_request())
        {
            $this->loadDatabaseConnection();
            $this->loadApiLibraries();
            if (file_exists(system_path("registered-libraries-api.php")))
            {
                require system_path("registered-libraries-api.php");
            }

            if (file_exists(system_path("registered-global-middlewares-api.php")))
            {
                require system_path("registered-global-middlewares-api.php");
            }

            $app->group('/api', function() {
                require base_path("routes/api.php");
            });
        }
        else
        {
            $this->loadDatabaseConnection(true);
            $this->loadLibraries();
            require system_path("registered-libraries.php");

            require system_path("registered-global-middlewares.php");
            $this->loadMiddlewares($app, $container);

            require base_path("routes/api.php");
            require base_path("routes/web.php");

            Profiler::finish("Application Done!");
        }
    }