CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
index.ts
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| 1deedc2 | 1 | import { Hono } from "hono"; |
| 2 | ||
| 3 | type Todo = { id: number; title: string; done: boolean }; | |
| 4 | ||
| 5 | const app = new Hono(); | |
| 6 | const todos: Todo[] = [ | |
| 7 | { id: 1, title: "Try GlueCron", done: false }, | |
| 8 | { id: 2, title: "Push a commit", done: false }, | |
| 9 | ]; | |
| 10 | ||
| 11 | app.get("/health", (c) => c.json({ ok: true })); | |
| 12 | app.get("/todos", (c) => c.json(todos)); | |
| 13 | ||
| 14 | app.post("/todos", async (c) => { | |
| 15 | const body = await c.req.json<{ title?: string }>(); | |
| 16 | if (!body?.title) return c.json({ error: "title required" }, 400); | |
| 17 | const todo: Todo = { id: todos.length + 1, title: body.title, done: false }; | |
| 18 | todos.push(todo); | |
| 19 | return c.json(todo, 201); | |
| 20 | }); | |
| 21 | ||
| 22 | export default app; |