GitFOSS
~app/routes.tsx
.ts
TypeScript
(application/typescript)
// 1st-party
import {
  AppRouter,
  AppRouterGroup,
  AppRouterRoot,
  AppRouterRoute,
  AppRouterRouteGroup,
  IRouteParams,
  Router,
} from "@ethicdevs/react-monolith";
// 3rd-party
import React from "react";
// app
import {
  AppRoute,
  AppRouteParams,
  AppRoutePaths,
  AppRouteSchemas,
} from "./routes.defs";
import { authenticatedOrLogin, guestOrRedirect } from "./utils/server";
// app controllers
import {
  AuthController,
  HomeController,
  OrganizationController,
  RepositoryController,
  RepositoryPullRequestsController,
  SSHAuthController,
  SettingsController,
  SyntaxHighlightController,
  ThemeController,
  UserController,
} from "./controllers";

function getTypedRouter<RoutesParams extends IRouteParams = IRouteParams>() {
  return {
    Root: Router.Root as AppRouterRoot<RoutesParams>,
    Group: Router.Group as AppRouterRouteGroup<RoutesParams>,
    Route: Router.Route as AppRouterRoute<RoutesParams>,
  };
}

const RootAppRouter: AppRouter<AppRouteParams> = () => {
  const loggedOrLoginRedirect = authenticatedOrLogin();
  const guestOrDashboardRedirect = guestOrRedirect(
    AppRoutePaths[AppRoute.USER_DASHBOARD]
  );

  const { Root, Group, Route } = getTypedRouter<AppRouteParams>();

  return (
    <Root>
      <></>
      <Group type={AppRouterGroup.API}>
        <Route
          name={AppRoute.THEME_SET_SCHEME_ACTION}
          method={"GET"}
          path={AppRoutePaths[AppRoute.THEME_SET_SCHEME_ACTION]}
          schema={AppRouteSchemas[AppRoute.THEME_SET_SCHEME_ACTION]}
          handler={ThemeController.setThemeSchemeAction}
        />
        {/* --- */}
        <Route
          name={AppRoute.HOME}
          method={"GET"}
          path={AppRoutePaths[AppRoute.HOME]}
          preHandler={guestOrDashboardRedirect}
          handler={HomeController.getHomeView}
        />
        <Route
          name={AppRoute.SSH_AUTH}
          method={"POST"}
          path={AppRoutePaths[AppRoute.SSH_AUTH]}
          schema={AppRouteSchemas[AppRoute.SSH_AUTH]}
          handler={SSHAuthController.onSSHAuth}
        />
        {/* --- */}
        <Route
          name={AppRoute.AUTH_REGISTER}
          method={"GET"}
          path={AppRoutePaths[AppRoute.AUTH_REGISTER]}
          preHandler={guestOrDashboardRedirect}
          handler={AuthController.getRegisterView}
        />
        <Route
          name={AppRoute.AUTH_REGISTER_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.AUTH_REGISTER_ACTION]}
          preHandler={guestOrDashboardRedirect}
          schema={AppRouteSchemas[AppRoute.AUTH_REGISTER_ACTION]}
          handler={AuthController.postRegisterAction}
        />
        {/* --- */}
        <Route
          name={AppRoute.AUTH_LOGIN}
          method={"GET"}
          path={AppRoutePaths[AppRoute.AUTH_LOGIN]}
          preHandler={guestOrDashboardRedirect}
          schema={AppRouteSchemas[AppRoute.AUTH_LOGIN]}
          handler={AuthController.getLoginView}
        />
        <Route
          name={AppRoute.AUTH_LOGIN_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.AUTH_LOGIN_ACTION]}
          preHandler={guestOrDashboardRedirect}
          schema={AppRouteSchemas[AppRoute.AUTH_LOGIN_ACTION]}
          handler={AuthController.postLoginAction}
        />
        <Route
          name={AppRoute.AUTH_LOGOUT_ACTION}
          method={"GET"}
          path={AppRoutePaths[AppRoute.AUTH_LOGOUT_ACTION]}
          preHandler={loggedOrLoginRedirect}
          schema={AppRouteSchemas[AppRoute.AUTH_LOGOUT_ACTION]}
          handler={AuthController.getLogoutAction}
        />
        {/* --- */}
        <Route
          name={AppRoute.USER_DASHBOARD}
          method={"GET"}
          path={AppRoutePaths[AppRoute.USER_DASHBOARD]}
          preHandler={loggedOrLoginRedirect}
          handler={UserController.getUserDashboardView}
        />
        <Route
          name={AppRoute.USER_DETAILS}
          method={"GET"}
          path={AppRoutePaths[AppRoute.USER_DETAILS]}
          handler={UserController.getUserDetailsView}
        />
        {/* --- */}
        <Route
          name={AppRoute.SETTINGS}
          method={"GET"}
          path={AppRoutePaths[AppRoute.SETTINGS]}
          preHandler={loggedOrLoginRedirect}
          handler={SettingsController.getSettingsView}
        />
        <Route
          name={AppRoute.SETTINGS_KEYS}
          method={"GET"}
          path={AppRoutePaths[AppRoute.SETTINGS_KEYS]}
          preHandler={loggedOrLoginRedirect}
          handler={SettingsController.getKeysListView}
        />
        <Route
          name={AppRoute.SETTINGS_KEY_ADD}
          method={"GET"}
          path={AppRoutePaths[AppRoute.SETTINGS_KEY_ADD]}
          preHandler={loggedOrLoginRedirect}
          handler={SettingsController.getKeyAddView}
        />
        <Route
          name={AppRoute.SETTINGS_KEY_ADD_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.SETTINGS_KEY_ADD_ACTION]}
          preHandler={loggedOrLoginRedirect}
          handler={SettingsController.postKeyAddAction}
        />
        <Route
          name={AppRoute.SETTINGS_KEY_UPDATE}
          method={"GET"}
          path={AppRoutePaths[AppRoute.SETTINGS_KEY_UPDATE]}
          preHandler={loggedOrLoginRedirect}
          handler={SettingsController.getKeyUpdateView}
        />
        <Route
          name={AppRoute.SETTINGS_KEY_UPDATE_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.SETTINGS_KEY_UPDATE_ACTION]}
          preHandler={loggedOrLoginRedirect}
          handler={SettingsController.postKeyUpdateAction}
        />
        {/* --- */}
        <Route
          name={AppRoute.ORGANIZATION_DETAILS}
          method={"GET"}
          path={AppRoutePaths[AppRoute.ORGANIZATION_DETAILS]}
          schema={AppRouteSchemas[AppRoute.ORGANIZATION_DETAILS]}
          handler={OrganizationController.getOrganizationDetailsView}
        />
        {/* --- */}
        <Route
          name={AppRoute.REPOSITORY_BROWSER}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_BROWSER]}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_BROWSER]}
          handler={RepositoryController.getRepositoryBrowserView}
        />
        <Route
          name={AppRoute.REPOSITORY_BROWSER_WITH_PATH}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_BROWSER_WITH_PATH]}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_BROWSER]}
          handler={RepositoryController.getRepositoryBrowserView}
        />
        <Route
          name={AppRoute.REPOSITORY_COMMITS_LOG}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_COMMITS_LOG]}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_COMMITS_LOG]}
          handler={RepositoryController.getRepositoryCommitsLogView}
        />
        <Route
          name={AppRoute.REPOSITORY_COMPARE}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_COMPARE]}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_COMPARE]}
          handler={RepositoryController.getRepositoryCompareView}
        />
        <Route
          name={AppRoute.REPOSITORY_CREATE}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_CREATE]}
          preHandler={loggedOrLoginRedirect}
          handler={RepositoryController.getRepositoryCreateView}
        />
        <Route
          name={AppRoute.REPOSITORY_CREATE_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.REPOSITORY_CREATE_ACTION]}
          preHandler={loggedOrLoginRedirect}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_CREATE_ACTION]}
          handler={RepositoryController.postRepositoryCreateAction}
        />
        <Route
          name={AppRoute.REPOSITORY_DETAILS}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_DETAILS]}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_DETAILS]}
          handler={RepositoryController.getRepositoryDetailsView}
        />
        <Route
          name={AppRoute.REPOSITORY_DETAILS_WITH_TRAILING_SLASH}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_DETAILS_WITH_TRAILING_SLASH]}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_DETAILS]}
          handler={RepositoryController.getRepositoryDetailsView}
        />
        <Route
          name={AppRoute.REPOSITORY_EXPLORE}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_EXPLORE]}
          handler={RepositoryController.getRepositoryExploreView}
        />
        <Route
          name={AppRoute.REPOSITORY_FORK}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_FORK]}
          preHandler={loggedOrLoginRedirect}
          handler={RepositoryController.getRepositoryForkView}
        />
        <Route
          name={AppRoute.REPOSITORY_FORK_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.REPOSITORY_FORK_ACTION]}
          preHandler={loggedOrLoginRedirect}
          handler={RepositoryController.postRepositoryForkAction}
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUEST_CLOSE_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.REPOSITORY_PULL_REQUEST_CLOSE_ACTION]}
          schema={
            AppRouteSchemas[AppRoute.REPOSITORY_PULL_REQUEST_CLOSE_ACTION]
          }
          preHandler={loggedOrLoginRedirect}
          handler={
            RepositoryPullRequestsController.getRepositoryPullRequestCloseAction
          }
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUEST_COMMENT_CREATE_ACTION}
          method={"POST"}
          path={
            AppRoutePaths[
              AppRoute.REPOSITORY_PULL_REQUEST_COMMENT_CREATE_ACTION
            ]
          }
          schema={
            AppRouteSchemas[
              AppRoute.REPOSITORY_PULL_REQUEST_COMMENT_CREATE_ACTION
            ]
          }
          preHandler={loggedOrLoginRedirect}
          handler={
            RepositoryPullRequestsController.getRepositoryPullRequestCommentCreateAction
          }
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUEST_COMMENT_DELETE_ACTION}
          method={"POST"}
          path={
            AppRoutePaths[
              AppRoute.REPOSITORY_PULL_REQUEST_COMMENT_DELETE_ACTION
            ]
          }
          schema={
            AppRouteSchemas[
              AppRoute.REPOSITORY_PULL_REQUEST_COMMENT_DELETE_ACTION
            ]
          }
          preHandler={loggedOrLoginRedirect}
          handler={
            RepositoryPullRequestsController.getRepositoryPullRequestCommentDeleteAction
          }
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUEST_COMMENT_UPDATE_ACTION}
          method={"POST"}
          path={
            AppRoutePaths[
              AppRoute.REPOSITORY_PULL_REQUEST_COMMENT_UPDATE_ACTION
            ]
          }
          schema={
            AppRouteSchemas[
              AppRoute.REPOSITORY_PULL_REQUEST_COMMENT_UPDATE_ACTION
            ]
          }
          preHandler={loggedOrLoginRedirect}
          handler={
            RepositoryPullRequestsController.getRepositoryPullRequestCommentUpdateAction
          }
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUEST_CREATE}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_PULL_REQUEST_CREATE]}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_PULL_REQUEST_CREATE]}
          preHandler={loggedOrLoginRedirect}
          handler={
            RepositoryPullRequestsController.getRepositoryPullRequestCreateView
          }
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUEST_CREATE_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.REPOSITORY_PULL_REQUEST_CREATE_ACTION]}
          schema={
            AppRouteSchemas[AppRoute.REPOSITORY_PULL_REQUEST_CREATE_ACTION]
          }
          preHandler={loggedOrLoginRedirect}
          handler={
            RepositoryPullRequestsController.postRepositoryPullRequestCreateAction
          }
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUEST_DELETE_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.REPOSITORY_PULL_REQUEST_DELETE_ACTION]}
          schema={
            AppRouteSchemas[AppRoute.REPOSITORY_PULL_REQUEST_DELETE_ACTION]
          }
          preHandler={loggedOrLoginRedirect}
          handler={
            RepositoryPullRequestsController.getRepositoryPullRequestDeleteAction
          }
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUEST_DETAILS}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_PULL_REQUEST_DETAILS]}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_PULL_REQUEST_DETAILS]}
          preHandler={loggedOrLoginRedirect}
          handler={
            RepositoryPullRequestsController.getRepositoryPullRequestDetailsView
          }
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUEST_MERGE_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.REPOSITORY_PULL_REQUEST_MERGE_ACTION]}
          schema={
            AppRouteSchemas[AppRoute.REPOSITORY_PULL_REQUEST_MERGE_ACTION]
          }
          preHandler={loggedOrLoginRedirect}
          handler={
            RepositoryPullRequestsController.postRepositoryPullRequestMergeAction
          }
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUEST_UPDATE_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.REPOSITORY_PULL_REQUEST_UPDATE_ACTION]}
          schema={
            AppRouteSchemas[AppRoute.REPOSITORY_PULL_REQUEST_UPDATE_ACTION]
          }
          preHandler={loggedOrLoginRedirect}
          handler={
            RepositoryPullRequestsController.getRepositoryPullRequestUpdateAction
          }
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUESTS}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_PULL_REQUESTS]}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_PULL_REQUESTS]}
          handler={
            RepositoryPullRequestsController.getRepositoryPullRequestsView
          }
        />
        <Route
          name={AppRoute.REPOSITORY_SHOW_OBJECT}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_SHOW_OBJECT]}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_SHOW_OBJECT]}
          handler={RepositoryController.getRepositoryShowObjectView}
        />
        {/* --- */}
        <Route
          name={AppRoute.SYNTAX_HIGHLIGHT_HIGHLIGHT_CODE_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.SYNTAX_HIGHLIGHT_HIGHLIGHT_CODE_ACTION]}
          schema={
            AppRouteSchemas[AppRoute.SYNTAX_HIGHLIGHT_HIGHLIGHT_CODE_ACTION]
          }
          handler={SyntaxHighlightController.highlightCodeAction}
        />
      </Group>
    </Root>
  );
};

export default RootAppRouter;

~app/routes.tsx
.ts
TypeScript
(application/typescript)
// 1st-party
import {
  AppRouter,
  AppRouterGroup,
  AppRouterRoot,
  AppRouterRoute,
  AppRouterRouteGroup,
  IRouteParams,
  Router,
} from "@ethicdevs/react-monolith";
// 3rd-party
import React from "react";
// app
import {
  AppRoute,
  AppRouteParams,
  AppRoutePaths,
  AppRouteSchemas,
} from "./routes.defs";
import { authenticatedOrLogin, guestOrRedirect } from "./utils/server";
// app controllers
import {
  AuthController,
  HomeController,
  OrganizationController,
  RepositoryController,
  RepositoryPullRequestsController,
  SSHAuthController,
  SettingsController,
  SyntaxHighlightController,
  ThemeController,
  UserController,
} from "./controllers";

function getTypedRouter<RoutesParams extends IRouteParams = IRouteParams>() {
  return {
    Root: Router.Root as AppRouterRoot<RoutesParams>,
    Group: Router.Group as AppRouterRouteGroup<RoutesParams>,
    Route: Router.Route as AppRouterRoute<RoutesParams>,
  };
}

const RootAppRouter: AppRouter<AppRouteParams> = () => {
  const loggedOrLoginRedirect = authenticatedOrLogin();
  const guestOrDashboardRedirect = guestOrRedirect(
    AppRoutePaths[AppRoute.USER_DASHBOARD]
  );

  const { Root, Group, Route } = getTypedRouter<AppRouteParams>();

  return (
    <Root>
      <></>
      <Group type={AppRouterGroup.API}>
        <Route
          name={AppRoute.THEME_SET_SCHEME_ACTION}
          method={"GET"}
          path={AppRoutePaths[AppRoute.THEME_SET_SCHEME_ACTION]}
          schema={AppRouteSchemas[AppRoute.THEME_SET_SCHEME_ACTION]}
          handler={ThemeController.setThemeSchemeAction}
        />
        {/* --- */}
        <Route
          name={AppRoute.HOME}
          method={"GET"}
          path={AppRoutePaths[AppRoute.HOME]}
          preHandler={guestOrDashboardRedirect}
          handler={HomeController.getHomeView}
        />
        <Route
          name={AppRoute.SSH_AUTH}
          method={"POST"}
          path={AppRoutePaths[AppRoute.SSH_AUTH]}
          schema={AppRouteSchemas[AppRoute.SSH_AUTH]}
          handler={SSHAuthController.onSSHAuth}
        />
        {/* --- */}
        <Route
          name={AppRoute.AUTH_REGISTER}
          method={"GET"}
          path={AppRoutePaths[AppRoute.AUTH_REGISTER]}
          preHandler={guestOrDashboardRedirect}
          handler={AuthController.getRegisterView}
        />
        <Route
          name={AppRoute.AUTH_REGISTER_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.AUTH_REGISTER_ACTION]}
          preHandler={guestOrDashboardRedirect}
          schema={AppRouteSchemas[AppRoute.AUTH_REGISTER_ACTION]}
          handler={AuthController.postRegisterAction}
        />
        {/* --- */}
        <Route
          name={AppRoute.AUTH_LOGIN}
          method={"GET"}
          path={AppRoutePaths[AppRoute.AUTH_LOGIN]}
          preHandler={guestOrDashboardRedirect}
          schema={AppRouteSchemas[AppRoute.AUTH_LOGIN]}
          handler={AuthController.getLoginView}
        />
        <Route
          name={AppRoute.AUTH_LOGIN_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.AUTH_LOGIN_ACTION]}
          preHandler={guestOrDashboardRedirect}
          schema={AppRouteSchemas[AppRoute.AUTH_LOGIN_ACTION]}
          handler={AuthController.postLoginAction}
        />
        <Route
          name={AppRoute.AUTH_LOGOUT_ACTION}
          method={"GET"}
          path={AppRoutePaths[AppRoute.AUTH_LOGOUT_ACTION]}
          preHandler={loggedOrLoginRedirect}
          schema={AppRouteSchemas[AppRoute.AUTH_LOGOUT_ACTION]}
          handler={AuthController.getLogoutAction}
        />
        {/* --- */}
        <Route
          name={AppRoute.USER_DASHBOARD}
          method={"GET"}
          path={AppRoutePaths[AppRoute.USER_DASHBOARD]}
          preHandler={loggedOrLoginRedirect}
          handler={UserController.getUserDashboardView}
        />
        <Route
          name={AppRoute.USER_DETAILS}
          method={"GET"}
          path={AppRoutePaths[AppRoute.USER_DETAILS]}
          handler={UserController.getUserDetailsView}
        />
        {/* --- */}
        <Route
          name={AppRoute.SETTINGS}
          method={"GET"}
          path={AppRoutePaths[AppRoute.SETTINGS]}
          preHandler={loggedOrLoginRedirect}
          handler={SettingsController.getSettingsView}
        />
        <Route
          name={AppRoute.SETTINGS_KEYS}
          method={"GET"}
          path={AppRoutePaths[AppRoute.SETTINGS_KEYS]}
          preHandler={loggedOrLoginRedirect}
          handler={SettingsController.getKeysListView}
        />
        <Route
          name={AppRoute.SETTINGS_KEY_ADD}
          method={"GET"}
          path={AppRoutePaths[AppRoute.SETTINGS_KEY_ADD]}
          preHandler={loggedOrLoginRedirect}
          handler={SettingsController.getKeyAddView}
        />
        <Route
          name={AppRoute.SETTINGS_KEY_ADD_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.SETTINGS_KEY_ADD_ACTION]}
          preHandler={loggedOrLoginRedirect}
          handler={SettingsController.postKeyAddAction}
        />
        <Route
          name={AppRoute.SETTINGS_KEY_UPDATE}
          method={"GET"}
          path={AppRoutePaths[AppRoute.SETTINGS_KEY_UPDATE]}
          preHandler={loggedOrLoginRedirect}
          handler={SettingsController.getKeyUpdateView}
        />
        <Route
          name={AppRoute.SETTINGS_KEY_UPDATE_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.SETTINGS_KEY_UPDATE_ACTION]}
          preHandler={loggedOrLoginRedirect}
          handler={SettingsController.postKeyUpdateAction}
        />
        {/* --- */}
        <Route
          name={AppRoute.ORGANIZATION_DETAILS}
          method={"GET"}
          path={AppRoutePaths[AppRoute.ORGANIZATION_DETAILS]}
          schema={AppRouteSchemas[AppRoute.ORGANIZATION_DETAILS]}
          handler={OrganizationController.getOrganizationDetailsView}
        />
        {/* --- */}
        <Route
          name={AppRoute.REPOSITORY_BROWSER}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_BROWSER]}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_BROWSER]}
          handler={RepositoryController.getRepositoryBrowserView}
        />
        <Route
          name={AppRoute.REPOSITORY_BROWSER_WITH_PATH}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_BROWSER_WITH_PATH]}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_BROWSER]}
          handler={RepositoryController.getRepositoryBrowserView}
        />
        <Route
          name={AppRoute.REPOSITORY_COMMITS_LOG}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_COMMITS_LOG]}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_COMMITS_LOG]}
          handler={RepositoryController.getRepositoryCommitsLogView}
        />
        <Route
          name={AppRoute.REPOSITORY_COMPARE}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_COMPARE]}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_COMPARE]}
          handler={RepositoryController.getRepositoryCompareView}
        />
        <Route
          name={AppRoute.REPOSITORY_CREATE}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_CREATE]}
          preHandler={loggedOrLoginRedirect}
          handler={RepositoryController.getRepositoryCreateView}
        />
        <Route
          name={AppRoute.REPOSITORY_CREATE_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.REPOSITORY_CREATE_ACTION]}
          preHandler={loggedOrLoginRedirect}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_CREATE_ACTION]}
          handler={RepositoryController.postRepositoryCreateAction}
        />
        <Route
          name={AppRoute.REPOSITORY_DETAILS}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_DETAILS]}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_DETAILS]}
          handler={RepositoryController.getRepositoryDetailsView}
        />
        <Route
          name={AppRoute.REPOSITORY_DETAILS_WITH_TRAILING_SLASH}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_DETAILS_WITH_TRAILING_SLASH]}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_DETAILS]}
          handler={RepositoryController.getRepositoryDetailsView}
        />
        <Route
          name={AppRoute.REPOSITORY_EXPLORE}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_EXPLORE]}
          handler={RepositoryController.getRepositoryExploreView}
        />
        <Route
          name={AppRoute.REPOSITORY_FORK}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_FORK]}
          preHandler={loggedOrLoginRedirect}
          handler={RepositoryController.getRepositoryForkView}
        />
        <Route
          name={AppRoute.REPOSITORY_FORK_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.REPOSITORY_FORK_ACTION]}
          preHandler={loggedOrLoginRedirect}
          handler={RepositoryController.postRepositoryForkAction}
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUEST_CLOSE_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.REPOSITORY_PULL_REQUEST_CLOSE_ACTION]}
          schema={
            AppRouteSchemas[AppRoute.REPOSITORY_PULL_REQUEST_CLOSE_ACTION]
          }
          preHandler={loggedOrLoginRedirect}
          handler={
            RepositoryPullRequestsController.getRepositoryPullRequestCloseAction
          }
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUEST_COMMENT_CREATE_ACTION}
          method={"POST"}
          path={
            AppRoutePaths[
              AppRoute.REPOSITORY_PULL_REQUEST_COMMENT_CREATE_ACTION
            ]
          }
          schema={
            AppRouteSchemas[
              AppRoute.REPOSITORY_PULL_REQUEST_COMMENT_CREATE_ACTION
            ]
          }
          preHandler={loggedOrLoginRedirect}
          handler={
            RepositoryPullRequestsController.getRepositoryPullRequestCommentCreateAction
          }
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUEST_COMMENT_DELETE_ACTION}
          method={"POST"}
          path={
            AppRoutePaths[
              AppRoute.REPOSITORY_PULL_REQUEST_COMMENT_DELETE_ACTION
            ]
          }
          schema={
            AppRouteSchemas[
              AppRoute.REPOSITORY_PULL_REQUEST_COMMENT_DELETE_ACTION
            ]
          }
          preHandler={loggedOrLoginRedirect}
          handler={
            RepositoryPullRequestsController.getRepositoryPullRequestCommentDeleteAction
          }
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUEST_COMMENT_UPDATE_ACTION}
          method={"POST"}
          path={
            AppRoutePaths[
              AppRoute.REPOSITORY_PULL_REQUEST_COMMENT_UPDATE_ACTION
            ]
          }
          schema={
            AppRouteSchemas[
              AppRoute.REPOSITORY_PULL_REQUEST_COMMENT_UPDATE_ACTION
            ]
          }
          preHandler={loggedOrLoginRedirect}
          handler={
            RepositoryPullRequestsController.getRepositoryPullRequestCommentUpdateAction
          }
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUEST_CREATE}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_PULL_REQUEST_CREATE]}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_PULL_REQUEST_CREATE]}
          preHandler={loggedOrLoginRedirect}
          handler={
            RepositoryPullRequestsController.getRepositoryPullRequestCreateView
          }
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUEST_CREATE_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.REPOSITORY_PULL_REQUEST_CREATE_ACTION]}
          schema={
            AppRouteSchemas[AppRoute.REPOSITORY_PULL_REQUEST_CREATE_ACTION]
          }
          preHandler={loggedOrLoginRedirect}
          handler={
            RepositoryPullRequestsController.postRepositoryPullRequestCreateAction
          }
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUEST_DELETE_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.REPOSITORY_PULL_REQUEST_DELETE_ACTION]}
          schema={
            AppRouteSchemas[AppRoute.REPOSITORY_PULL_REQUEST_DELETE_ACTION]
          }
          preHandler={loggedOrLoginRedirect}
          handler={
            RepositoryPullRequestsController.getRepositoryPullRequestDeleteAction
          }
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUEST_DETAILS}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_PULL_REQUEST_DETAILS]}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_PULL_REQUEST_DETAILS]}
          preHandler={loggedOrLoginRedirect}
          handler={
            RepositoryPullRequestsController.getRepositoryPullRequestDetailsView
          }
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUEST_MERGE_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.REPOSITORY_PULL_REQUEST_MERGE_ACTION]}
          schema={
            AppRouteSchemas[AppRoute.REPOSITORY_PULL_REQUEST_MERGE_ACTION]
          }
          preHandler={loggedOrLoginRedirect}
          handler={
            RepositoryPullRequestsController.postRepositoryPullRequestMergeAction
          }
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUEST_UPDATE_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.REPOSITORY_PULL_REQUEST_UPDATE_ACTION]}
          schema={
            AppRouteSchemas[AppRoute.REPOSITORY_PULL_REQUEST_UPDATE_ACTION]
          }
          preHandler={loggedOrLoginRedirect}
          handler={
            RepositoryPullRequestsController.getRepositoryPullRequestUpdateAction
          }
        />
        <Route
          name={AppRoute.REPOSITORY_PULL_REQUESTS}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_PULL_REQUESTS]}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_PULL_REQUESTS]}
          handler={
            RepositoryPullRequestsController.getRepositoryPullRequestsView
          }
        />
        <Route
          name={AppRoute.REPOSITORY_SHOW_OBJECT}
          method={"GET"}
          path={AppRoutePaths[AppRoute.REPOSITORY_SHOW_OBJECT]}
          schema={AppRouteSchemas[AppRoute.REPOSITORY_SHOW_OBJECT]}
          handler={RepositoryController.getRepositoryShowObjectView}
        />
        {/* --- */}
        <Route
          name={AppRoute.SYNTAX_HIGHLIGHT_HIGHLIGHT_CODE_ACTION}
          method={"POST"}
          path={AppRoutePaths[AppRoute.SYNTAX_HIGHLIGHT_HIGHLIGHT_CODE_ACTION]}
          schema={
            AppRouteSchemas[AppRoute.SYNTAX_HIGHLIGHT_HIGHLIGHT_CODE_ACTION]
          }
          handler={SyntaxHighlightController.highlightCodeAction}
        />
      </Group>
    </Root>
  );
};

export default RootAppRouter;

GitFOSS • v0.2.0 (#421408f) • MIT License