(pathname: string)
| 84 | }; |
| 85 | |
| 86 | export const getDocsMarkdownResponse = async (pathname: string) => { |
| 87 | const route = getMarkdownRoute(pathname); |
| 88 | if (!route) return null; |
| 89 | |
| 90 | const page = source.getPage(route.split('/').filter(Boolean)); |
| 91 | |
| 92 | if (!page) { |
| 93 | return new Response('Not found', { status: 404 }); |
| 94 | } |
| 95 | |
| 96 | const text = await getDocsPageMarkdown(page); |
| 97 | |
| 98 | return new Response(text, { |
| 99 | headers: { |
| 100 | 'Content-Type': 'text/markdown; charset=utf-8', |
| 101 | 'Cache-Control': 'public, max-age=300', |
| 102 | }, |
| 103 | }); |
| 104 | }; |
no test coverage detected