title: Cannot access mongodb through browser - It looks like you are trying to access MongoDB over HTTP on the native driver port
body: <p>I open terminal and enter the following commands</p>
  
  <pre><code>sudo mongod
  </code></pre>
  
  <p>which then outputs</p>
  
  <pre><code>[initandlisten] waiting for connections on port 27017
  </code></pre>
  
  <p>I open another terminal and enter</p>
  
  <pre><code>sudo mongo
  </code></pre>
  
  <p>which open the mongo shell and prompts for mongo commands, but when I go to localhost/27017 I receive the following message:</p>
  
  <pre><code>It looks like you are trying to access MongoDB over HTTP on the native driver port.
  </code></pre>
  
  <p>I created a simple nodejs application using express and when I <code>POST</code> data it seems the mongodb gets hung up. This is the message which I receive in the terminal in which I start my express application and the page never posts the data. So I believe the problem lies within mongo but I cannot figure it out. </p>
  
  <pre><code>POST /info 200 120002ms
  </code></pre>
  
  <p>Here is my express code</p>
  
  <pre><code>var Info = require('../models/info');
  var path = require('path');
  var fs = require('fs');
  var join = path.join;
  
  exports.form = function(req,res){
  
      res.render('info', {
          myName: 'Michael'
      });
  };
  
  exports.submit = function(){
  console.log('Within exports.submit 1');
      return function(req,res,next){
          console.log('Within exports.submit 2 ');
          var firstName = req.name.first;
          var lastName = req.name.last;
          Info.create({
              firstName: firstName,
              lastName: lastName
          },function(err){
              if(err) return next(err);
  
              res.redirect('/')
          });
      }
  };
  </code></pre>
  
  <p>Model</p>
  
  <pre><code>var mongoose = require('mongoose');
  mongoose.connect('mongodb://localhost/info');
  
  var schema = new mongoose.Schema({
      firstName: String,
      lastName: String
  });
  
  module.exports = mongoose.model('info',schema);
  </code></pre>
  
  <p>app.js </p>
  
  <pre><code>...
  app.get('/info',info.form);
  app.post('/info',info.submit);
  ...
  </code></pre>