title: Having Trouble connecting MongoDB with Mongoose
body: <p>0</p>
  
  <p>I'm Following a MERN Stack tutorial from Udemy and I'm trying to connect mongodb with mongoose. The code I have configures is here:</p>
  
  <p>(db.js)</p>
  
  <pre><code>const mongoose = require('mongoose');
  const config = require('config');
  const db = config.get('mongoURI');
  
  const connectDB = async () =&gt; {
    try {
      await mongoose.connect(db);
  
      console.log('MongoDB Connect...');
    } catch (err) {
      console.error(err.message);
      //Exit process with falure
      process.exit(1);
    }
  };
  
  module.exports = connectDB;
  </code></pre>
  
  <p>(server.js)</p>
  
  <pre><code>const express = require('express');
  const connectDB = require('./config/db');
  
  const app = express();
  
  //connect database
  connectDB();
  
  app.get('/', (req, res) =&gt; res.send('API Running'));
  
  const PORT = process.env.PORT || 5000;
  
  app.listen(PORT, () =&gt; console.log(`Server started on port ${PORT}`));
  </code></pre>
  
  <p>(package.json)</p>
  
  <pre><code>{
    "name": "devconnect",
    "version": "1.0.0",
    "description": "Social Network for Developers",
    "main": "server.js",
    "scripts": {
      "start": "node server",
      "server": "nodemon server"
    },
    "author": "Jason Thomas",
    "license": "MIT",
    "dependencies": {
      "bcryptjs": "^2.4.3",
      "config": "^3.2.5",
      "express": "^4.17.1",
      "express-validator": "^6.3.1",
      "gravatar": "^1.8.0",
      "jsonwebtoken": "^8.5.1",
      "mongoose": "^5.8.9",
      "request": "^2.88.0"
    },
    "devDependencies": {
      "concurrently": "^5.0.2",
      "nodemon": "^2.0.2"
    }
  }
  </code></pre>
  
  <p>After I enter [npm run server]This is my error message</p>
  
  <pre><code>Server started on port 5000
  Password contains an illegal unescaped character
  [nodemon] app crashed - waiting for file changes before starting...
  </code></pre>
  
  <p>I cant figure this out and I know its something simple, What am I doing wrong, How do I fix this?</p>
  
  <p>Best Regards
  &amp; Thank You</p>