blob: 6b9bfec4072adfd6524c018492f135e5e775654c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import { Client } from "https://deno.land/x/mysql/mod.ts";
export default class Connector {
async connect(): Promise<Client> {
try {
return await new Client().connect({
hostname: Deno.env.get("DBHost"),
username: Deno.env.get("DBUser"),
db: Deno.env.get("DBName"),
password: Deno.env.get("DBPassword"),
});
} catch (e) {
console.error("Could not connect to database!");
throw e;
}
}
}
|