Facula\Framework::registerHook('ready', 'exec', function () {
    if (!($routeMap = Facula\Framework::core('cache')->load('Routes'))) {
        Facula\Unit\Route::setup(array('/' => array('MyProject\\Controller\\Home\\Index', array(), true)));
        Facula\Framework::summonHook('route_init');
        Facula\Framework::core('cache')->save('Routes', Facula\Unit\Route::exportMap(), 0);
    } else {
        Facula\Unit\Route::importMap($routeMap);
    }
    Facula\Unit\Route::setErrorHandler(function ($type) {
        $pageContent = '';
        switch ($type) {
            case 'PATH_NOT_FOUND':
            case 'PATH_NO_OPERATOR':
            case 'PATH_NO_OPERATOR_SPECIFIED':
            default:
                if ($pageContent = Facula\Framework::core('template')->render('message.404')) {
                    Facula\Framework::core('response')->setHeader('HTTP/1.1 404 Not Found');
                    Facula\Framework::core('response')->setContent($pageContent);
                    Facula\Framework::core('response')->send();
                }
                break;
        }
        return true;
    });
    if (file_exists(Facula\Framework::PATH . DIRECTORY_SEPARATOR . '.htaccess')) {
        $path = array('Prefix' => '/', 'Path' => $_SERVER['QUERY_STRING']);
    } else {
        $path = array('Prefix' => '/?/', 'Path' => $_SERVER['QUERY_STRING']);
    }
    if (Facula\Unit\Route::setPath($path['Path'])) {
        Facula\Framework::core('template')->assign('RouteRoot', Facula\Framework::core('request')->getClientInfo('rootURL') . $path['Prefix']);
        Facula\Framework::core('template')->assign('AbsRouteRoot', Facula\Framework::core('request')->getClientInfo('absRootURL') . $path['Prefix']);