feature: html with SSI
This commit is contained in:
parent
d917b69753
commit
0f65e57539
10 changed files with 210 additions and 27 deletions
|
@ -22,24 +22,6 @@ export default async function handle_static_files(request: Request): Promise<Res
|
|||
try {
|
||||
const stat = await Deno.stat(normalized_path);
|
||||
|
||||
if (stat.isDirectory) {
|
||||
const extensions: string[] = media_types.allExtensions('text/html') ?? ['html', 'htm'];
|
||||
|
||||
for (const extension of extensions) {
|
||||
const index_path = path.join(normalized_path, `index.${extension}`);
|
||||
const index_stat = await Deno.stat(index_path);
|
||||
if (index_stat.isFile) {
|
||||
return new Response(await Deno.readFile(index_path), {
|
||||
headers: {
|
||||
'Content-Type': 'text/html'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (stat.isFile) {
|
||||
const extension = path.extname(normalized_path)?.slice(1)?.toLowerCase() ?? '';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue