mirror of
https://git.sfja.dk/Mikkel/slige.git
synced 2025-01-18 12:46:31 +00:00
22 lines
454 B
TypeScript
22 lines
454 B
TypeScript
import { Application, Router } from "jsr:@oak/oak";
|
|
|
|
const app = new Application();
|
|
|
|
const router = new Router();
|
|
|
|
app.use(router.routes());
|
|
app.use(router.allowedMethods());
|
|
|
|
app.use(async (ctx, next) => {
|
|
try {
|
|
await ctx.send({ root: "./public", index: "index.html" });
|
|
} catch {
|
|
next();
|
|
}
|
|
});
|
|
|
|
const port = 8000;
|
|
const listener = app.listen({ port });
|
|
console.log(`Listening at http://localhost:${port}/`);
|
|
await listener;
|