Event-Planner / server / index.js
index.js
Raw
// server/index.js
const express = require("express");
const mongoose = require("mongoose");
const app = express()
const Router = require("./routes")

require('dotenv').config(); // Load environment variables from .env file
// const Server = require('./server');
// const server = new Server();
// server.listen();

mongoose.connect('mongodb+srv://powerzaws:ffwocB67DuKXPG6M@497-event-planning.mdg0uqr.mongodb.net/?retryWrites=true&w=majority',
  {
    useNewUrlParser: true,
    useUnifiedTopology: true
  }
);

const db = mongoose.connection;
db.on("error", console.error.bind(console, "connection error: "));
db.once("open", function () {
  console.log("Connected to DB successfully");
});