This repository has been archived on 2025-12-11. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
authapp/authserver/middlewares/serveStaticMiddleware.js
AndrewTrieu c9f31e5c8a First commit
2023-04-21 13:17:50 +03:00

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 };