Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index.js #362

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions backend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@ import dbConnection from "./src/db/dbConnection.js";
import { v2 as cloudinary } from 'cloudinary';
import app from "./app.js";

// cloudinary configuration
// Cloudinary configuration
cloudinary.config({
cloud_name: process.env.CLOUDINARY_CLOUD_NAME,
api_key: process.env.CLOUDINARY_API_KEY,
api_secret: process.env.CLOUDINARY_API_SECRET
cloud_name: process.env.CLOUDINARY_CLOUD_NAME || 'your_default_cloud_name', // Add a default value or log an error if not set
api_key: process.env.CLOUDINARY_API_KEY || 'your_default_api_key', // Same as above
api_secret: process.env.CLOUDINARY_API_SECRET || 'your_default_api_secret' // Same as above
});


// Database connnection configuration
// Database connection configuration
dbConnection()
.then(() => {
app.listen(process.env.PORT || 8000, () => {
console.log(`⚙️ Server is running at port : ${process.env.PORT}`);
})
const port = process.env.PORT || 8000;
app.listen(port, (err) => {
if (err) {
console.error("Error starting server:", err);
} else {
console.log(`⚙️ Server is running at port: ${port}`);
}
});
})
.catch((err) => {
console.log("MONGO db connection failed !!! ", err);
})
console.error("MongoDB connection failed: ", err);
});