mongoDbConfig

PHOTO EMBED

Sun Sep 05 2021 14:27:58 GMT+0000 (UTC)

Saved by @devdave

// [1] IMPORT SECT.
// -
const mongoose = require("mongoose");
const dotEnv = require("dotenv").config({ path: "./config/.env" });

mongoose
  .connect(
    "mongodb+srv://" +
      process.env.DB_USER_PASS +
      "@cluster0.xsxcm.mongodb.net/test?retryWrites=true&w=majority",
    { useNewUrlParser: true, useUnifiedTopology: true }
  )
  .then(() => console.log("Connexion à MongoDB réussie !"))
  .catch((err) => console.log("Connexion à MongoDB échouée !", err));
content_copyCOPY