16 lines
361 B
JavaScript
16 lines
361 B
JavaScript
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 };
|