CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
app.tsx
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| 79136bb | 1 | import { Hono } from "hono"; |
| 2 | import { logger } from "hono/logger"; | |
| 3 | import { cors } from "hono/cors"; | |
| 4 | import { Layout } from "./views/layout"; | |
| 5 | import gitRoutes from "./routes/git"; | |
| 6 | import apiRoutes from "./routes/api"; | |
| 7 | import authRoutes from "./routes/auth"; | |
| 8 | import settingsRoutes from "./routes/settings"; | |
| 9 | import issueRoutes from "./routes/issues"; | |
| 10 | import repoSettings from "./routes/repo-settings"; | |
| 11 | import compareRoutes from "./routes/compare"; | |
| 0074234 | 12 | import pullRoutes from "./routes/pulls"; |
| 13 | import editorRoutes from "./routes/editor"; | |
| c81ab7a | 14 | import forkRoutes from "./routes/fork"; |
| 15 | import webhookRoutes from "./routes/webhooks"; | |
| 16 | import exploreRoutes from "./routes/explore"; | |
| 17 | import tokenRoutes from "./routes/tokens"; | |
| 79136bb | 18 | import webRoutes from "./routes/web"; |
| 19 | ||
| 20 | const app = new Hono(); | |
| 21 | ||
| 22 | // Middleware | |
| 23 | app.use("*", logger()); | |
| 24 | app.use("/api/*", cors()); | |
| 25 | ||
| 26 | // Git Smart HTTP protocol routes (must be before web routes) | |
| 27 | app.route("/", gitRoutes); | |
| 28 | ||
| 29 | // REST API | |
| 30 | app.route("/", apiRoutes); | |
| 31 | ||
| 32 | // Auth routes (register, login, logout) | |
| 33 | app.route("/", authRoutes); | |
| 34 | ||
| 35 | // Settings routes (profile, SSH keys) | |
| 36 | app.route("/", settingsRoutes); | |
| 37 | ||
| c81ab7a | 38 | // API tokens |
| 39 | app.route("/", tokenRoutes); | |
| 40 | ||
| 79136bb | 41 | // Repo settings (description, visibility, delete) |
| 42 | app.route("/", repoSettings); | |
| 43 | ||
| c81ab7a | 44 | // Webhooks management |
| 45 | app.route("/", webhookRoutes); | |
| 46 | ||
| 79136bb | 47 | // Compare view (branch diffs) |
| 48 | app.route("/", compareRoutes); | |
| 49 | ||
| 50 | // Issue tracker | |
| 51 | app.route("/", issueRoutes); | |
| 52 | ||
| 0074234 | 53 | // Pull requests |
| 54 | app.route("/", pullRoutes); | |
| 55 | ||
| c81ab7a | 56 | // Fork |
| 57 | app.route("/", forkRoutes); | |
| 58 | ||
| 0074234 | 59 | // Web file editor |
| 60 | app.route("/", editorRoutes); | |
| 61 | ||
| c81ab7a | 62 | // Explore page |
| 63 | app.route("/", exploreRoutes); | |
| 64 | ||
| 79136bb | 65 | // Web UI (catch-all, must be last) |
| 66 | app.route("/", webRoutes); | |
| 67 | ||
| 68 | // Global 404 | |
| 69 | app.notFound((c) => { | |
| 70 | return c.html( | |
| 71 | <Layout title="Not Found"> | |
| 72 | <div class="empty-state"> | |
| 73 | <h2>404</h2> | |
| 74 | <p>Page not found.</p> | |
| 75 | <a href="/" style="margin-top: 12px; display: inline-block"> | |
| 76 | Go home | |
| 77 | </a> | |
| 78 | </div> | |
| 79 | </Layout>, | |
| 80 | 404 | |
| 81 | ); | |
| 82 | }); | |
| 83 | ||
| 84 | // Global error handler | |
| 85 | app.onError((err, c) => { | |
| 86 | console.error("[error]", err); | |
| 87 | return c.html( | |
| 88 | <Layout title="Error"> | |
| 89 | <div class="empty-state"> | |
| 90 | <h2>Something went wrong</h2> | |
| 91 | <p>An unexpected error occurred.</p> | |
| 92 | {process.env.NODE_ENV !== "production" && ( | |
| 93 | <pre style="margin-top: 16px; text-align: left; font-size: 12px; color: var(--red)"> | |
| 94 | {err.message} | |
| 95 | </pre> | |
| 96 | )} | |
| 97 | </div> | |
| 98 | </Layout>, | |
| 99 | 500 | |
| 100 | ); | |
| 101 | }); | |
| 102 | ||
| 103 | export default app; |