You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the server.js file of our project, there's an essential component missing: the import statement for MongoDB connection. This oversight could potentially lead to runtime errors or issues when attempting to interact with the database.
Expected Behavior:
There should be an import statement for the MongoDB connection module/library.
Actual Behavior:
The import statement for MongoDB connection is missing.
Proposed Solution:
Server.js
import express from "express";
import cors from "cors";
import records from "./routes/record.js";
import dotenv from "dotenv"
import conn from "./db/connection.js"; //importing conn function from db/conncection.js file
const PORT = process.env.PORT || 5050;
const app = express();
dotenv.config();
app.use(cors());
app.use(express.json());
app.use("/record", records);
// start the Express server
app.listen(PORT, () => {
conn(); //add this for connecting to database
console.log(Server listening on port ${PORT});
});
The text was updated successfully, but these errors were encountered:
In the server.js file of our project, there's an essential component missing: the import statement for MongoDB connection. This oversight could potentially lead to runtime errors or issues when attempting to interact with the database.
Expected Behavior:
There should be an import statement for the MongoDB connection module/library.
Actual Behavior:
The import statement for MongoDB connection is missing.
Proposed Solution:
Server.js
import express from "express";
import cors from "cors";
import records from "./routes/record.js";
import dotenv from "dotenv"
import conn from "./db/connection.js"; //importing conn function from db/conncection.js file
const PORT = process.env.PORT || 5050;
const app = express();
dotenv.config();
app.use(cors());
app.use(express.json());
app.use("/record", records);
// start the Express server
app.listen(PORT, () => {
conn(); //add this for connecting to database
console.log(
Server listening on port ${PORT}
);});
The text was updated successfully, but these errors were encountered: