(url, rootDir)
| 11 | } |
| 12 | |
| 13 | export async function render(url, rootDir) { |
| 14 | const pathname = url.replace(/#[^#]*$/, '').replace(/\?[^?]*$/, '') |
| 15 | const renderer = pathRenderers[pathname] |
| 16 | if (renderer) { |
| 17 | return await renderer(rootDir) |
| 18 | } |
| 19 | return '404' |
| 20 | } |
| 21 | |
| 22 | async function renderRoot(rootDir) { |
| 23 | const paths = Object.keys(pathRenderers).filter((key) => key !== '/') |