title: How to resolve a Socket.io 404 (Not Found) error?
body: <p>I am using Socket.io with Express. In my project I have a login page and a home page. When I do successful login, I navigate to localhost:3000/home where I get this error:</p>
  
  <pre><code>GET http://localhost:3000/socket.io/?EIO=3&amp;transport=polling&amp;t=1418187395022-0 404 (Not Found)
  </code></pre>
  
  <p>I did not do any modification in my <code>app.js</code> (project created by express ).</p>
  
  <p>index.js:</p>
  
  <pre><code>var express = require('express');
  var router = express.Router();
  var http = require('http');
  var fs = require('fs');
  var io = require('socket.io')(http);
  /* GET home page. */
  router.get('/', function(req, res) {
    res.render('index', { title: 'Express' });
  });
  
  router.get('/home', function(req, res) {
    res.render('home', { title: 'Express' });
  });
  
  io.on('connection', function(socket){
      console.log("User Connected");
    socket.on('chat message', function(msg){
      io.emit('chat message', msg);
      console.log("Message");
    });
     socket.on('disconnect', function(msg){
      console.log("User DisConnected");
    });
  
  });
  
  router.post('/authenticate', function(req, res) {
      fs.readFile("./public/Verification/Users.json", "utf8", function (err, data) {
          if (err) 
              console.log(err);
          else{
              var result = JSON.parse(data);
              for(var i=0;i&lt;result.Users.length;i++){
                  if(req.body.username == result.Users[i].username &amp;&amp; req.body.password ==     result.Users[i].password){
                      console.log("Success!!!!!!!!!!!!!!");
                      res.location("home");
                      res.redirect("home");
                  }
              }
          }
          });
  });
  
  module.exports = router;
  </code></pre>
  
  <p>In my <code>layout.jade</code> I defined Socket.io like this:</p>
  
  <pre><code>script(src='https://cdn.socket.io/socket.io-1.2.0.js')
  </code></pre>