File size: 250 Bytes
a8ce9cb
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import mongoose from "mongoose";

export const connectToDatabase = async (connectionString: string) => {
  try {
    await mongoose.connect(connectionString);
    console.log("connected to the database");
  } catch (e) {
    console.error(e);
  }
};