Initialize routes.
438857
def setup_admin_on_rest_handlers(admin, admin_handler):
    
    add_route = admin.router.add_route
    add_static = admin.router.add_static
    static_folder = str(PROJ_ROOT / 'static')
    a = admin_handler

    add_route('GET', '', a.index_page, name='admin.index')
    add_route('POST', '/token', a.token, name='admin.token')
    add_static('/static', path=static_folder, name='admin.static')
    add_route('DELETE', '/logout', a.logout, name='admin.logout')
906109
private function initRouter()
    {
        $this->di->mapService('core.router', '\Core\Router\Router');

        $this->router = $this->di->get('core.router');
        $this->router->setBaseUrl(BASEURL);
        $this->router->setParametersToTarget([
            'app',
            'controller',
            'action'
        ]);
        $this->router->addMatchTypes([
            'mvc' => '[A-Za-z0-9_]++'
        ]);

        // Generic routes
        $routes = [
            'index' => [
                'route' => '/[mvc:app]/[mvc:controller]',
                'target' => [
                    'action' => 'index'
                ]
            ],
            'action' => [
                'route' => '/[mvc:app]/[mvc:controller]/[mvc:action]'
            ],
            'id' => [
                'route' => '/[mvc:app]/[mvc:controller]/[i:id]?/[mvc:action]'
            ],
            'child' => [
                'route' => '/[mvc:app]/[mvc:controller]/[i:id]?/[mvc:action]/of/[i:id_parent]'
            ]
        ];

        foreach ($routes as $name => $route) {
            $this->router->map($route['method'] ?? 'GET|POST', $route['route'], $route['target'] ?? [], 'generic.' . $name);
        }
    }
852011
protected function initializeRoutesConfiguration()
    {
        if ($this->routesConfiguration === null) {
            $this->routesConfiguration = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_ROUTES);
        }
    }
365024
function initEnhancers(routes) {
    invariant(routes.filter(actionConfig => !actionConfig.driverInstance).length===0, 'Routes must have instantiated drivers');

    return routes
        .filter(actionConfig => actionConfig.driverInstance.middleware)
        .map(actionConfig => actionConfig.driverInstance.middleware());
}
645438
def init_app(self, app):
        
        if self._route is None:
            raise TypeError(
                "route is a required argument when app is not None")

        app.rak = self
        app.add_url_rule(self._route, view_func=getattr(self, self._view_name), methods=['POST'])
1275052
def _init_routes_and_middlewares(self):
        """"""
        self._init_middlewares()
        self._init_endpoints()

        self.app = falcon.API(middleware=self.middleware)
        self.app.add_error_handler(Exception, self._error_handler)

        for version_path, endpoints in self.catalog:
            for route, resource in endpoints:
                self.app.add_route(version_path + route, resource)
43191
public function init()
    {
        // Autoload the models and components directory 
        $this->setImport(array(
            'api.models.*',
            'api.components.*',
        ));
        
        // Disable layout rendering
        $this->layout = false;
        
        // Disable logging for the API
        foreach(Yii::app()->log->routes as $k=>$v)
        {
            if (get_class($v) == 'CWebLogRoute' || get_class($v) == "CProfileLogRoute")
                Yii::app()->log->routes[$k]->enabled = false; 
        }
        
        // Set default components and routes
        Yii::app()->setComponents(array(
            'errorHandler' => array(
                'errorAction'  => 'api/default/error',
            ),
            'messages' => array(
                'class' => 'cii.components.CiiPHPMessageSource',
                'basePath' => Yii::getPathOfAlias('application.modules.api')
            )
        ));
    }
225814
public function setupRoutes()
    {
        foreach ($this->paths as $oldPath => &$newPath) {
            $this->addRedirection($oldPath, $newPath);
        }
    }
792948
function setRoutesInState(routes) {
    const routesByName = {};
    routes.forEach(route => {
        routesByName[route.name] = route.route;
    });
    return routesByName;
}
1084090
public function init()
    {
        $this->attachBehavior('TbWidget', new TbWidget);
        $this->resolveId();
        $route = $this->controller->getRoute();
        if ($this->stacked) {
            TbHtml::addCssClass('nav-stacked', $this->htmlOptions);
        }
        if (isset($this->scrollspy)) {
            if (is_string($this->scrollspy)) {
                $this->scrollspy = array('target' => $this->scrollspy);
            }
            $this->widget('\TbScrollspy', $this->scrollspy);
        }
        $this->items = $this->normalizeItems($this->items, $route, $hasActiveChild);
    }
309541
public void setRoutes(java.util.Collection<OriginationRoute> routes) {
        if (routes == null) {
            this.routes = null;
            return;
        }

        this.routes = new java.util.ArrayList<OriginationRoute>(routes);
    }
1070831
private function initEvents()
    {
        $this->router->on('NotFound', function($request, $response) {
            $response
                ->setStatus(404)
                ->write('Not found')
                ->end();
        });

        $this->router->on('error', function ($request, $response, $error) {
            $response
                ->reset()
                ->setStatus(500)
                ->write($error)
                ->end();
        });
    }
377125
public function initialize()
    {
        //The global dispatcher

        //state the application is initialized;
        //register aliases as class mocks such that static calls on mock map to instance calls;
        $this->createAliasMock(
            array_merge(
                $this->aliases, [
                    "route" => 'Budkit\Routing\Router', //this such that we can call Route::add to add router;
                    'controller' => 'Budkit\Routing\Controller',
                    'view' => 'Budkit\View\Display'
                ]
            )
        );

        //Trigger the app initialise event;
        $this->observer->trigger(new Event("app.init", $this));
    }
1041893
protected function initRouter()
    {

        // Get all routes from local bootstrap
        $routes = $this->setRoutes();

        // Send all routes to Router
        foreach ($routes as $route) {
            if ($route[0] == 'any') {
                Router::any($route[1], $route[2]);
            } elseif ($route[0] == 'get') {
                Router::get($route[1], $route[2]);
            } elseif ($route[0] == 'post') {
                Router::post($route[1], $route[2]);
            } else {
                echo error::display('Route Error: bad declaration');
            }
        }

        // Set default controller and action for errors
        Router::error('\Core\Error@index');
        Router::dispatch();
    }
480672
private static function initPages()
    {
        $modelPage = Yii::createObject(Page::class);
        $pages = $modelPage::find()->getMap()->asArray()->all();

        if ($pages) {
            foreach ($pages as $page) {
                self::$pages[$page['id']] = $page;
            }
        }

    }
993453
private function buildRoutes(): void{
        require_once 'System.php';
        System::reflectionRoutes($this, $this->app);
        foreach ($this->types as $type) {
            /* @var $type Type */
            $type->applyRoutes($this, $this->app);
        }
    }
866736
public function init()
    {
        parent::init();

        $routes = $this->findAvailableRoutes();
        $route = $this->getRequest()->getVar('endpoint') ?: $this->config()->default_route;

        // Legacy. Find the first route mapped to the controller.
        if (!$route && !empty($routes)) {
            $route = $routes[0];
        }

        if (!$route) {
            throw new \RuntimeException("There are no routes set up for a GraphQL server. You will need to add one to the SilverStripe\Control\Director.rules config setting.");
        }

        $route = trim($route, '/');
        $jsonRoutes = json_encode($routes);
        $securityID = Controller::config()->enable_csrf_protection
            ? "'" . SecurityToken::inst()->getValue() . "'"
            : 'null';
        Requirements::customScript(
            <<<JS
var GRAPHQL_ROUTE = '{$route}';
var GRAPHQL_ROUTES = $jsonRoutes;
var SECURITY_ID = $securityID;
JS
        );

        Requirements::javascript('silverstripe/graphql-devtools: client/dist/graphiql.js');
    }