title: "Cannot GET /null" when running a server with nodejs
body: <p>Edit #2: Uhhhhhh, the error went away after I restarted my computer. I didn't change anything. Another fine day wasted on a bug that didn't even exist....</p>
  
  <p>I guess you can delete this?</p>
  
  <p>My code was working fine without any routes before, but then this started happening and I didn't commit in like a day so I don't want to load my last save. What does this mean and how can I fix it?</p>
  
  <p>I don't really know what to ask because there's nothing similar to what I'm experiencing when you search for "cannot get/null nodejs" on google. I have like 500 lines of code if you want me to post it.</p>
  
  <pre><code>_________________________________
  &lt;!doctype html&gt;
  &lt;html&gt;
  &lt;body&gt;
  &lt;div id="signDiv"&gt;
  Username: &lt;input id="signDiv-username" type="text"&gt;&lt;/input&gt;&lt;br&gt;
  Password: &lt;input id="signDiv-password" type="password"&gt;&lt;/input&gt;&lt;br&gt;
  &lt;button id="signDiv-signIn"&gt;Sign in&lt;/button&gt;
  &lt;button id="signDiv-signUp"&gt;Sign up&lt;/button&gt; 
  &lt;/div&gt;
  
  &lt;div id="gameDiv" style="display:none;"&gt;
      &lt;canvas id="ctx" width="500" height="500" style="border:1px solid #000000;"&gt;&lt;/canvas&gt;
  
      &lt;div id="chat-text" style="width:500px; height:100px; overflow-y:scroll"&gt;
          &lt;div&gt;Hello&lt;/div&gt;
      &lt;/div&gt;
  
      &lt;form id="chat-form"&gt;
          &lt;input id="chat-input" type="text" style="width:500px"&gt;&lt;/input&gt;
      &lt;/form&gt;
  
  &lt;/div&gt;
  
  &lt;script src="http://cdn.socket.io/socket.io-1.4.5.js"&gt;&lt;/script&gt;
  &lt;script src="http://code.jquery.com/jquery-1.11.1.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
    var userip;
  &lt;/script&gt;
  
  &lt;script type="text/javascript" src="https://l2.io/ip.js?var=userip"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
    document.write("Your IP is :", userip);
  &lt;/script&gt;
  
  
  
  &lt;script&gt;
      var socket = io();
  
      //sign in/up
      var signDiv = document.getElementById('signDiv');
      var signDivUsername = document.getElementById('signDiv-username');
      var signDivSignIn = document.getElementById('signDiv-signIn');
      var signDivSignUp = document.getElementById('signDiv-signUp');
      var signDivPassword = document.getElementById('signDiv-password');
  
      signDivSignIn.onclick = function(){
          socket.emit('signIn',{username:signDivUsername.value,password:signDivPassword.value});
      };
      signDivSignUp.onclick = function(){
          socket.emit('signUp',{username:signDivUsername.value,password:signDivPassword.value});
      };
      socket.on('signInResponse', function(data){
          if(data.success){
              signDiv.style.display = 'none';
              gameDiv.style.display = 'inline-block';
          } else
              alert("Sign in unsuccessul.");
      });
  
      socket.on('signUpResponse', function(data){
          if(data.success){
              alert("Sign up successful.");
          } else
              alert("Sign up unsuccessul.");
      });
  
  
  
      var chatText = document.getElementById("chat-text");
      var chatInput = document.getElementById("chat-input");
      var chatForm = document.getElementById("chat-form");
  
      var ctx = document.getElementById("ctx").getContext("2d");
      ctx.font = "30px Arial";
  
  
      socket.on('newPositions', function (data){
          ctx.clearRect(0,0,500,500);
          for(var i=0 ; i &lt; data.player.length; i++)
              ctx.fillText(data.player[i].number, data.player[i].x, data.player[i].y);        
  
          for(var i=0 ; i &lt; data.bullet.length; i++)
              ctx.fillRect(data.bullet[i].x-5, data.bullet[i].y-5, 10, 10);       
      });
  
      // socket.on('hit event', function(linkbulletdata){
      //  window.location=String(linkbulletdata);
      //  signDiv.style.display = 'inline-block';
      //  gameDiv.style.display = 'none';
  
  
      // });
  
  
  
      socket.on('addToChat', function(data){
          chatText.innerHTML += '&lt;div&gt;' + data + '&lt;/div&gt;';
      });
  
  
      socket.on('evalAnswer', function(data){
          console.log(data);
      });
  
  
  
      chatForm.onsubmit = function(e){
          e.preventDefault();
          if(chatInput.value[0] === '/') {
              socket.emit('evalServer', chatInput.value.slice(1));
          }
          else {socket.emit('sendMsgToServerLoadGun', chatInput.value);}
          chatInput.value = '';
      }
  
  
      $(document).ready(function(){
          $("body").keydown(function(e){
                switch(e.which) {
                    case 32: //space ATTACK
                    socket.emit('keyPress', {inputId:'attack', state:true});
                    console.log('shoot');
                    break;
  
                    case 37: // left
                   socket.emit('keyPress', {inputId: 'left', state: true }); 
                    console.log("keycode= " + e.keyCode); 
                    break;
  
                    case 38: // up
                      socket.emit('keyPress', {inputId: 'up', state: true }); 
                    console.log("keycode= " + e.keyCode); 
                    break;
  
                    case 39: // right
                    socket.emit('keyPress', {inputId: 'right', state: true }); 
                    console.log("keycode= " + e.keyCode); 
                    break;
  
                    case 40: // down
                    socket.emit('keyPress', {inputId: 'down', state: true });
                    console.log("keycode= " + e.keyCode); 
                    break;
  
                    default: return; // exit this handler for other keys
                }
                e.preventDefault(); // prevent the default action (scroll / move caret)
  
  
          });
      });
  
      document.onmousemove = function(event){
          var x = -250 + event.clientX -8;
          var y = -250 + event.clientY -8;
          var angle = Math.atan2(y,x)/Math.PI*180;
          socket.emit('keyPress', {inputId:'mouseAngle', state:angle});
      }
  
      document.onmousedown = function(event){
          socket.emit('keyPress', {inputId:'attack', state:true});
      }
  
      document.onmouseup = function(event){
          socket.emit('keyPress', {inputId:'attack', state:false});
      }
  
  
      $(document).ready(function(){
          $("body").keyup(function(e){
                switch(e.which) {
                    case 32: //space
                    console.log('space');
                    socket.emit('keyPress', {inputId:'attack', state:false});
                    break;
  
                    case 37: // left
                   socket.emit('keyPress', {inputId: 'left', state: false }); 
                    console.log("keycode= " + e.keyCode); 
                    break;
  
                    case 38: // up
                      socket.emit('keyPress', {inputId: 'up', state: false }); 
                    console.log("keycode= " + e.keyCode); 
                    break;
  
                    case 39: // right
                    socket.emit('keyPress', {inputId: 'right', state: false }); 
                    console.log("keycode= " + e.keyCode); 
                    break;
  
                    case 40: // down
                    socket.emit('keyPress', {inputId: 'down', state: false }); 
                    console.log("keycode= " + e.keyCode); 
                    break;
  
                    default: return; // exit this handler for other keys
                }
                e.preventDefault(); // prevent the default action (scroll / move caret)
  
  
          });
      });
  
  
  
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>