diff options
Diffstat (limited to 'src/main.ts')
-rw-r--r-- | src/main.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main.ts b/src/main.ts index bcdb632..e87e14b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,11 +1,18 @@ import { Application, Context } from "https://deno.land/x/abc@v1/mod.ts"; +import { renderFile } from "https://deno.land/x/dejs/mod.ts"; import "https://deno.land/x/dotenv/load.ts"; const port = parseInt(Deno.env.get("PORT") || "8080"); const app = new Application(); +app.renderer = { + render<T>(name: string, data: T): Promise<Deno.Reader> { + return renderFile(name, data); + }, +}; + app.static("/", "./src/public/"); // Manage static files -app.file("/", "./src/public/index.html"); // Render index on / +app.get("/", async (c: Context) => await c.render("./src/public/index.html")); // Render index on / app.start({ port }); console.log(`Server listening on http://localhost:${port}`); |