title: Node.js connections with MongoDB
body: <p>I need help with creating my server because it won't work. I am trying to connect my server with MongoDB using Mongoose and Express.</p>
  
  <pre><code>const express = require('express');
  const app = express();
  const mongoose = require('mongoose');
  
  mongoose.connect('mongodb://localhost:27017/node');
  var mongoDB = 'mongodb://localhost:27017/node';
  mongoose.connect(mongoDB);
  
  mongoose.Promise = global.Promise;
  
  let db = mongoose.connection;
  
  db.on('error', console.error.bind(console, 'MongoDB connection error:'));
  
  //check DB erorr
  db.on('erorr',function(err){
      console.log(err);
  });
  </code></pre>
  
  <p>app.listen('2701<code>enter code here</code>7',function(){
      console.log('server localhost is 27017....')
  });</p>