First commit

This commit is contained in:
AndrewTrieu
2023-04-21 13:17:50 +03:00
commit c9f31e5c8a
26 changed files with 465 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
import { send } from "../deps.js";
const serveStaticMiddleware = async (context, next) => {
if (context.request.url.pathname.startsWith("/static")) {
const path = context.request.url.pathname.substring(7);
await send(context, path, {
root: `${Deno.cwd()}/static`,
});
} else {
await next();
}
};
export { serveStaticMiddleware };