Skip to content

Commit c77b0ec

Browse files
committed
feat: single dynamic route
1 parent c6e33fc commit c77b0ec

File tree

12 files changed

+59
-209
lines changed

12 files changed

+59
-209
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import fs from "fs/promises"
2+
import path from "path"
3+
import type { APIRoute } from "astro"
4+
5+
export const GET: APIRoute = async ({ params }) => {
6+
const { section } = params
7+
8+
const supportedSections = [
9+
"vrf",
10+
"ccip",
11+
"data-feeds",
12+
"data-streams",
13+
"chainlink-functions",
14+
"chainlink-automation",
15+
"resources",
16+
"architecture-overview",
17+
"getting-started",
18+
"chainlink-nodes",
19+
"chainlink-local",
20+
]
21+
22+
if (!section || !supportedSections.includes(section)) {
23+
return new Response("Section not found or not supported.", { status: 404 })
24+
}
25+
26+
const filePath = path.resolve(`src/content/${section}/llms-full.txt`)
27+
28+
try {
29+
const fileContents = await fs.readFile(filePath, "utf-8")
30+
return new Response(fileContents, {
31+
status: 200,
32+
headers: {
33+
"Content-Type": "text/plain",
34+
},
35+
})
36+
} catch (error) {
37+
return new Response("File not found.", { status: 404 })
38+
}
39+
}
40+
41+
export function getStaticPaths() {
42+
const supportedSections = [
43+
"vrf",
44+
"ccip",
45+
"data-feeds",
46+
"data-streams",
47+
"chainlink-functions",
48+
"chainlink-automation",
49+
"resources",
50+
"architecture-overview",
51+
"getting-started",
52+
"chainlink-nodes",
53+
"chainlink-local",
54+
]
55+
56+
return supportedSections.map((section) => ({
57+
params: { section },
58+
}))
59+
}

src/pages/architecture-overview/llms-full.txt.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/pages/ccip/llms-full.txt.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/pages/chainlink-automation/llms-full.txt.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/pages/chainlink-functions/llms-full.txt.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/pages/chainlink-local/llms-full.txt.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/pages/chainlink-nodes/llms-full.txt.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/pages/data-feeds/llms-full.txt.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/pages/data-streams/llms-full.txt.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/pages/getting-started/llms-full.txt.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)