12 lines
270 B
TypeScript
12 lines
270 B
TypeScript
import { MongoClient } from 'mongodb';
|
|
|
|
const MongoUri = 'mongodb://owl:twittwoo@localhost:27017/';
|
|
|
|
let dbClient: MongoClient | null = null;
|
|
|
|
export async function mongoConnect() {
|
|
if (!dbClient) {
|
|
dbClient = await MongoClient.connect(MongoUri)
|
|
}
|
|
return dbClient
|
|
} |