Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesPull RequestsActionsSecurityInsightsSettings
✨ AI
More
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.

app.tsxBlame79 lines · 1 contributor
79136bbClaude1import { Hono } from "hono";
2import { logger } from "hono/logger";
3import { cors } from "hono/cors";
4import { Layout } from "./views/layout";
5import gitRoutes from "./routes/git";
6import apiRoutes from "./routes/api";
7import authRoutes from "./routes/auth";
8import settingsRoutes from "./routes/settings";
9import issueRoutes from "./routes/issues";
10import repoSettings from "./routes/repo-settings";
11import compareRoutes from "./routes/compare";
12import webRoutes from "./routes/web";
13
14const app = new Hono();
15
16// Middleware
17app.use("*", logger());
18app.use("/api/*", cors());
19
20// Git Smart HTTP protocol routes (must be before web routes)
21app.route("/", gitRoutes);
22
23// REST API
24app.route("/", apiRoutes);
25
26// Auth routes (register, login, logout)
27app.route("/", authRoutes);
28
29// Settings routes (profile, SSH keys)
30app.route("/", settingsRoutes);
31
32// Repo settings (description, visibility, delete)
33app.route("/", repoSettings);
34
35// Compare view (branch diffs)
36app.route("/", compareRoutes);
37
38// Issue tracker
39app.route("/", issueRoutes);
40
41// Web UI (catch-all, must be last)
42app.route("/", webRoutes);
43
44// Global 404
45app.notFound((c) => {
46 return c.html(
47 <Layout title="Not Found">
48 <div class="empty-state">
49 <h2>404</h2>
50 <p>Page not found.</p>
51 <a href="/" style="margin-top: 12px; display: inline-block">
52 Go home
53 </a>
54 </div>
55 </Layout>,
56 404
57 );
58});
59
60// Global error handler
61app.onError((err, c) => {
62 console.error("[error]", err);
63 return c.html(
64 <Layout title="Error">
65 <div class="empty-state">
66 <h2>Something went wrong</h2>
67 <p>An unexpected error occurred.</p>
68 {process.env.NODE_ENV !== "production" && (
69 <pre style="margin-top: 16px; text-align: left; font-size: 12px; color: var(--red)">
70 {err.message}
71 </pre>
72 )}
73 </div>
74 </Layout>,
75 500
76 );
77});
78
79export default app;