Skip to content

Commit 1687d72

Browse files
committed
feat: 開発サーバーのルーティングを改善
1 parent 4a43a18 commit 1687d72

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

website/src/index.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Hono } from "hono";
2+
import { appendTrailingSlash, trimTrailingSlash } from 'hono/trailing-slash'
23
import {
34
CategoryTemplate,
45
HtmlTemplate,
@@ -18,6 +19,12 @@ const docs = docsJson as unknown as Page[];
1819
const [flattenedPages, pagePaths] = flattenDocs(docs);
1920

2021
const app = new Hono();
22+
app.use(appendTrailingSlash())
23+
app.use(trimTrailingSlash())
24+
app.get("/", (c) => {
25+
return c.redirect("/docs");
26+
}
27+
);
2128

2229
flattenedPages.forEach((page, pageIndex) => {
2330
const path = pagePaths[pageIndex];

0 commit comments

Comments
 (0)