Initial Code
This commit is contained in:
20
src/lib/ts/db.ts
Executable file
20
src/lib/ts/db.ts
Executable file
@@ -0,0 +1,20 @@
|
||||
import { SECRET_DB_URI } from "$env/static/private";
|
||||
import mongoose from "mongoose";
|
||||
|
||||
import Playerdb from "./Userdb";
|
||||
|
||||
class DB {
|
||||
dbs: any;
|
||||
players: Playerdb;
|
||||
constructor() {
|
||||
this.players = new Playerdb();
|
||||
this.connect();
|
||||
}
|
||||
|
||||
connect() {
|
||||
mongoose.set('strictQuery', true);
|
||||
mongoose.connect(SECRET_DB_URI).then(() => { console.log("Connected to DataBase") });
|
||||
}
|
||||
}
|
||||
|
||||
export const db = new DB();
|
||||
Reference in New Issue
Block a user