api #3

Merged
SethTrowbridge merged 7 commits from api into master 2023-07-29 20:30:03 -04:00
Showing only changes of commit d2938ce6fe - Show all commits

View File

@ -270,10 +270,9 @@ const server = Deno.serve({port:parseInt(Deno.env.get("port")||"8000")}, async(r
const ext = Extension(url.pathname);
const headers = {"content-type":"application/json", "Access-Control-Allow-Origin": Configuration.Allow, "charset":"UTF-8"};
// cache-reset route
if(url.pathname === Configuration.Reset)
if(url.pathname.includes("/__"))
{
return new Response(`{"cleared":${Transpile.Clear()}}`, {headers});
return new Response(`{"error":"unmatched route", "path":"${url.pathname}"}`, {status:404, headers});
}
// allow for custom handler
@ -335,6 +334,12 @@ const server = Deno.serve({port:parseInt(Deno.env.get("port")||"8000")}, async(r
}
}
// cache-reset route
if(url.pathname === Configuration.Reset)
{
return new Response(`{"cleared":${Transpile.Clear()}}`, {headers});
}
// all other static files
if(ext)
{