13 lines
318 B
TypeScript
13 lines
318 B
TypeScript
import { DB } from "sqlite";
|
|
import { createSchema } from "./user.ts";
|
|
|
|
export function connectDB(): DB {
|
|
let DB_path = Deno.env.get("DB_PATH");
|
|
if (DB_path === undefined) {
|
|
Deno.env.set("DB_PATH", "./db.sqlite");
|
|
DB_path = "./db.sqlite";
|
|
}
|
|
let db = new DB(DB_path);
|
|
createSchema(db);
|
|
return db;
|
|
}
|