Define the "api" routes for the module.

These routes are typically stateless.

@return void
338492
protected function mapApiRoutes()
    {
        Route::group([
            'middleware' => 'api',
            'namespace'  => $this->namespace.'\Api',
            'domain'     => config('hstcms.apiDomain') ? config('hstcms.apiDomain') : env('APP_URL'),
            'prefix'     => config('hstcms.apiDomain') ? '' : config('hstcms.apiPrefix') ? config('hstcms.apiPrefix') : 'api',
        ], function ($router) {
             require __DIR__.'/../Routes/api.php';
        });
    }
208653
public function run() {
		// Setup our default error route responders
		$this->setup_error_routes();

		// To always be RESTful, create a last-hit route responder to respond in our designated format ALWAYS
		Router::route( function( $request, $response, $service, $matches ) {
			// ALWAYS respond with our formatting function
			Router::app()->api_respond();
		});

		// Finally, call "dispatch" to have our App's Router route the request appropriately
		Router::dispatch(
			substr(
				$_SERVER['REQUEST_URI'],
				strlen( rtrim( $this->config['app-meta']['base_url'], '/' ) ) // Remove a potential trailing slash
			)
		);
	}
225814
public function setupRoutes()
    {
        foreach ($this->paths as $oldPath => &$newPath) {
            $this->addRedirection($oldPath, $newPath);
        }
    }
694225
protected function routes()
    {
        if ($this->app->routesAreCached()) {
            return;
        }

        Route::middleware(['nova', 'api', Authorize::class])
            ->prefix('nova-vendor/spatie/nova-tags-field')
            ->group(__DIR__.'/../routes/api.php');
    }
999090
public function map()
    {
        $themeName = ltrim(
            str_replace(themes_path(), '', realpath(__DIR__.'/../../')),
            '\/'
        );

        Route::middleware('web')
            ->namespace($this->namespace)
            ->group(themes_path($themeName.'/routes.php'));
    }
255943
protected function registerCustomRoutes()
    {
        if (file_exists($file = $this->getBootstrapPath('routes.php'))) {
            $this->registerRoutes(function (Router $route) use ($file) {
                require $file;
            });
        }
    }
993600
protected function initRoutes()
    {
        $fileLocator = new FileLocator([__DIR__, SettingsPath::FULL_ROOT]);
        $loader = new YamlFileLoader($fileLocator);
        $routes = $loader->load('coreroutes.yaml');

        $headers = [
            'X-SESSION-ID',
            'X-UTC-OFFSET',
            'X-Requested-With',
            'X-File-Name',
        ];

        $this->request = Request::createFromGlobals();
        $this->response = new JsonResponse();

        $this->response->headers->set('Access-Control-Allow-Origin', '*');
        $this->response->headers->set('Access-Control-Allow-Headers', implode(',', $headers));

        $context = new RequestContext();
        $context->fromRequest($this->request);

        $this->url_matcher = new UrlMatcher($routes, $context);
    }
602965
protected function loadRoutesAndServices()
    {
        foreach ($this->modules as $module) {
            if ($module->getPathRoutes()) {
                $routesConfig = Util::getJson($module->getPathRoutes());
                $this->routes += $routesConfig;
            }

            if ($module->getPathServices()) {
                $servicesConfig = Util::getJson($module->getPathServices());
                $this->services += $servicesConfig;
            }
        }
    }
956906
private function generateFrontEndRoutes()
    {
        $this->comment("Front End Routes...");
        if (!$this->checkWilling('frontend')) {
            return $this->line("\tskip");
        }

        $moduleName = $this->starter->getModuleName();
        // 1. To generate the module route file if not exists and to update dynamic routes map.
        Utils::addFrontEndRouteFile($moduleName);
        // 2. Add new routes to the module route file.
        Utils::appendFrontEndRoutes($moduleName, $this->model);
    }
621585
public static function run()
    {
        self::init();

        /*
         * Register routes.
         */
        call_user_func(function () {
            /** @noinspection PhpIncludeInspection */
            require self::$basePath . '/boot/routes.php';
            if (file_exists(self::$basePath . '/.manifest/plugins/routes.php')) {
                /** @noinspection PhpIncludeInspection */
                include self::$basePath . '/.manifest/plugins/routes.php';
            }
        });

        /*
         * Dispatch the HTTP request and send the response to the browser.
         */
        /** @var \Core\Services\Contracts\Router $router */
        $router   = DI::getInstance()->get('router');
        $request  = DI::getInstance()->get('request');
        $response = $router->dispatch($request);
        $response->send();
    }
1007770
protected function initRoute(): void
    {
        foreach ($this->route as $route => &$pattern) {
            $pattern = $this->prepareRoutePattern($route);
        }
    }
916212
protected function setRouteProperties()
    {
        $this->current_route = $this->route->get();

        $this->path = $this->url->path();
        $this->is_backend = $this->url->isBackend();
        $this->is_install = $this->url->isInstall();

        $this->host = $this->server->httpHost();
        $this->scheme = $this->server->httpScheme();
        $this->uri_path = $this->server->requestUri();
        $this->is_ajax = $this->server->isAjaxRequest();
        $this->uri = $this->scheme . $this->host . $this->uri_path;

        $this->base = $this->request->base();
        $this->query = (array) $this->request->get(null, array(), 'array');
    }
355833
public function map()
    {
        Route::namespace($this->namespace)->group(function (Router $router) {

            /*
             * Admin routes
             */
            $router->middleware('admin')->prefix('admin')->group(function (Router $router) {
                $router->get('dashboard', 'AdminController@dashboard')->name('dashboard')->middleware('can:see-dashboard');
                $router->get('', 'AdminController@index')->middleware('can:see-dashboard');
            });
        });
    }
170776
protected function mapRoutes()
    {
        if (!$this->app->routesAreCached()) {
            Route::group(
                ['middleware' => ['web']], function () {
                    $routes = new Routes();

                    // Backend Routes
                    $routes->mapBackendRoutes()
                        ->mapPluginsBackendRoutes();

                    // Frontend Routes
                    $routes->mapFrontendBaseRoutes()
                        ->mapFrontendRoutes()
                        ->mapThemeRoutes()
                        ->mapPluginsFrontendRoutes();

                    // Add Language {lang} prefix
                    $routes->addLanguagePrefix()
                        ->sortRoutes();
                }
            );
        }
    }
726480
public function route()
    {
        if (!empty($this->mod)) {
            if ($this->mod == $this->modApiName) {
                $this->cmd = $this->ctrl . '.' . $this->action;
            }
        }
        if ($this->cmd != '') {
            $cmdParams = explode('.', $this->cmd);
            if (count($cmdParams) > 2) {
                $this->mod = $cmdParams[0];
                $this->cmd = $cmdParams[1] . '.' . $cmdParams[2];
            }
            $this->routeApi();
        } else {
            $this->routeCtrl();
        }
    }
83595
private function _route() {
        $this->profiler->addTime('route');

        $router = new Router($this);

        foreach ($this->config->config['route'] as $key => $value) {
            foreach ($value as $data) {
                $vars = explode(',', $data['vars']);
                $controller = explode('.', $data['action'])[0];
                $action = explode('.', $data['action'])[1];

                $router->addRoute(new Route($data['url'], $controller, $action, $data['name'], $data['cache'], $vars, $key, $data['logged'], $data['access'], $data['method']));
            }
        }

        $this->request->data->post = $_POST;
        $this->request->data->get = $_GET;
        $this->request->data->file = $_FILES;
        $this->request->data->method = strtolower($_SERVER['REQUEST_METHOD']);

        if (isset($_GET['request-get']) && $_SERVER['REQUEST_METHOD'] == 'GET') {
            $this->request->data->form = true;
            $this->request->data->method = 'get';
        }
        else if (isset($_POST['request-post'])) {
            $this->request->data->form = true;
            $this->request->data->method = 'post';
        }
        else if (isset($_POST['request-put'])) {
            $this->request->data->form = true;
            $this->request->data->method = 'put';
            $this->request->data->put = $_POST;
        }
        else if (isset($_POST['request-patch'])) {
            $this->request->data->form = true;
            $this->request->data->method = 'patch';
            $this->request->data->patch = $_POST;
        }
        else if (isset($_POST['request-delete'])) {
            $this->request->data->form = true;
            $this->request->data->method = 'delete';
            $this->request->data->delete = $_POST;
        }

        if ($_SERVER['REQUEST_METHOD'] == 'PUT') {
            parse_str(file_get_contents("php://input"), $put_vars);
            $this->request->data->put = $put_vars;
        }
        else if ($_SERVER['REQUEST_METHOD'] == 'PATCH') {
            parse_str(file_get_contents("php://input"), $patch_vars);
            $this->request->data->patch = $patch_vars;
        }
        else if ($_SERVER['REQUEST_METHOD'] == 'DELETE') {
            parse_str(file_get_contents("php://input"), $delete_vars);
            $this->request->data->delete = $delete_vars;
        }

        if ($matchedRoute = $router->getRoute(preg_replace('`\?' . preg_quote($_SERVER['QUERY_STRING']) . '`isU', '', $_SERVER['REQUEST_URI']), $this->config)) {
            $_GET = array_merge($_GET, $matchedRoute->vars());

            $this->request->name = $matchedRoute->name();
            $this->request->src = $matchedRoute->src();
            $this->request->controller = $matchedRoute->controller();
            $this->request->action = $matchedRoute->action();
            $this->request->logged = $matchedRoute->logged();
            $this->request->access = $matchedRoute->access();
            $this->request->method = $matchedRoute->method();
            $this->request->auth = new Auth($this->request->src);

            if ($this->config->config['user']['output']['cache']['enabled'] && $matchedRoute->cache() != '') {
                $this->request->cache = $matchedRoute->cache();
            }
            else {
                $this->request->cache = 0;
            }

            if ($this->request->action == '') {
                $this->request->action = 'default';
            }

            $this->_route = true;
        }

        $this->profiler->addTime('route', Profiler::USER_END);

        return $this;
    }
269203
private function registerRoutes()
    {
        collect(($routes = $this->getRoutes()))->each(function ($route) {
            $this->registerRoute($route);
        });

        $this->registerResourcesRoutes();
    }