diff options
Diffstat (limited to 'src/main.ts')
-rw-r--r-- | src/main.ts | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main.ts b/src/main.ts index e87e14b..5a4e2d3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,12 @@ -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"; +import { Application } from "https://deno.land/x/abc@v1/mod.ts"; +import type { Context } from "https://deno.land/x/abc@v1/mod.ts"; +import { renderFile } from "https://deno.land/x/dejs/mod.ts"; +import * as groups from "./groups/index.ts"; +import DBController from "./db/DBController.ts"; + +// Ugly solution +(async () => await (new DBController()).init())(); const port = parseInt(Deno.env.get("PORT") || "8080"); const app = new Application(); @@ -14,5 +20,11 @@ app.renderer = { app.static("/", "./src/public/"); // Manage static files app.get("/", async (c: Context) => await c.render("./src/public/index.html")); // Render index on / +// Load groups dynamically +for (let groupName in groups) { + // @ts-ignore + groups[groupName](app.group(groupName)); +} + app.start({ port }); console.log(`Server listening on http://localhost:${port}`); |