// [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));
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter