Initialized and setup backend

This commit is contained in:
Manik Maity
2024-11-05 21:12:58 +05:30
parent 50e9a7c6ae
commit 322e7a5b56
6 changed files with 1350 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
import mongoose from "mongoose";
import { DB_URL } from "./veriables.js";
export const connectDB = async () => {
try{
await mongoose.connect(DB_URL);
console.log("Database connected successfully");
}
catch(err){
console.log("Database connection failed");
console.log(err);
}
}

View File

@@ -0,0 +1,5 @@
import dotenv from "dotenv";
dotenv.config();
export const PORT = Number(process.env.PORT);
export const DB_URL = process.env.DB_CONNECTION;