mirror of
https://github.com/ProjectSegfault/website.git
synced 2025-04-05 18:45:24 +05:30
14 lines
302 B
TypeScript
14 lines
302 B
TypeScript
import { env } from "$env/dynamic/private";
|
|
import { building } from "$app/environment";
|
|
import { MongoClient } from "mongodb";
|
|
import type { Db } from "mongodb";
|
|
|
|
export let db: Db;
|
|
|
|
if (!building) {
|
|
const client = new MongoClient(env.DB_URL);
|
|
|
|
await client.connect();
|
|
|
|
db = client.db("website");
|
|
} |