diff options
author | Marvin Borner | 2020-07-18 20:09:03 +0200 |
---|---|---|
committer | Marvin Borner | 2020-07-18 20:09:03 +0200 |
commit | 5ad4683e2e59ea1d00558945872089bebea1c2b1 (patch) | |
tree | 5292033dc32b089f6d7a0775162bf24a5683acd1 | |
parent | 26f84c953f9fbb9c5afb4f8a063759d272256f36 (diff) |
Fixed abc submodule
-rw-r--r-- | .gitmodules | 4 | ||||
m--------- | src/abc | 0 | ||||
-rw-r--r-- | src/db/DBController.ts | 9 | ||||
-rw-r--r-- | src/groups/user.ts | 4 | ||||
-rw-r--r-- | src/handler/user.ts | 4 | ||||
-rw-r--r-- | src/main.ts | 8 |
6 files changed, 12 insertions, 17 deletions
diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index c9abcd5..0000000 --- a/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "src/abc"] - path = src/abc - url = git@github.com:LarsVomMars/abc.git - branch = std diff --git a/src/abc b/src/abc deleted file mode 160000 -Subproject adba5f857e1f2a53bfffba1aa184c6d2ca5c48e diff --git a/src/db/DBController.ts b/src/db/DBController.ts index 274e446..4188bd1 100644 --- a/src/db/DBController.ts +++ b/src/db/DBController.ts @@ -5,7 +5,7 @@ export default class DBController { private client?: Client; async init() { - this.client = await this.connect(); + await this.connect(); try { const sql = await readFileStr("./src/db/tables.sql"); const queries = sql.split(";"); @@ -18,9 +18,9 @@ export default class DBController { } } - async connect(): Promise<Client> { + async connect() { try { - return await new Client().connect({ + this.client = await new Client().connect({ hostname: Deno.env.get("DBHost"), username: Deno.env.get("DBUser"), db: Deno.env.get("DBName"), @@ -46,12 +46,13 @@ export default class DBController { if (!this.client) throw Error("Database isn't initialized yet!"); try { - await this.client.execute(query, params); + return await this.client.execute(query, params); } catch (e) { throw e; } } + // deno-lint-ignore no-explicit-any async execute_multiple(queries: any[][]) { if (!this.client) throw Error("Database isn't initialized yet!"); diff --git a/src/groups/user.ts b/src/groups/user.ts index 59cda82..614e432 100644 --- a/src/groups/user.ts +++ b/src/groups/user.ts @@ -1,5 +1,5 @@ -// import type { Group, Context } from "https://deno.land/x/abc@v1/mod.ts"; -import type { Group, Context } from "../abc/mod.ts"; +import type { Group, Context } from "https://deno.land/x/abc@master/mod.ts"; +// import type { Group, Context } from "../abc/mod.ts"; import * as handlers from "../handler/user.ts"; export default function (g: Group) { diff --git a/src/handler/user.ts b/src/handler/user.ts index 78db609..be4472b 100644 --- a/src/handler/user.ts +++ b/src/handler/user.ts @@ -1,5 +1,5 @@ -// import type { HandlerFunc, Context } from "https://deno.land/x/abc@v1/mod.ts"; -import type { HandlerFunc, Context } from "../abc/mod.ts"; +import type { HandlerFunc, Context } from "https://deno.land/x/abc@master/mod.ts"; +// import type { HandlerFunc, Context } from "../abc/mod.ts"; import db from "../db/user.ts"; export const index: HandlerFunc = async (c: Context) => c.params.name; diff --git a/src/main.ts b/src/main.ts index 9b16126..667131c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,8 +1,6 @@ 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 { Application } from "./abc/mod.ts"; -import type { Context } from "./abc/mod.ts"; +import { Application } from "https://deno.land/x/abc@master/mod.ts"; +import type { Context } from "https://deno.land/x/abc@master/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"; @@ -19,7 +17,7 @@ app.renderer = { }, }; -app.static("/", "./src/public/"); // Manage static files +app.static("/", "./src/public/"); // Manage static files - TODO: Consider serving css/js files separately app.get("/", async (c: Context) => await c.render("./src/public/test.html", { name: "test" })); // Render index on / // Load groups dynamically |