title: NodeJS Socket io client side script not found
body: <p>NodeJS 9.8.0<br>
  NodeJS client-side socket.io script not found.
  package.json: </p>
  
  <pre><code>..."dependencies": {
      "express": "latest",
      "socket.io": "latest"
  }...
  </code></pre>
  
  <p>index.js:</p>
  
  <pre><code>var http = require("http"),
      express = require("express"),
      io = require("socket.io").listen(http),
      fs = require("fs");
  
  var app = express();
  
  var web = __dirname.split("\\").join("/")+"/web/";
  
  app.get("/", function(req, res)
  {
      res.sendFile(web + "index.html");
  });
  app.get("/:file", function(req, res)
  {
      var file = web + req.param("file");
      var err = web + "error.html";
      fs.exists(file, function(exist)
      {
          if (exist) res.sendFile(file);
          else fs.exists(err, function(exist)
          {
              if (exist) res.sendFile(err);
              else res.send("&lt;h1&gt;Error! Page not found!&lt;/h1&gt;");
          });
      });
  });
  // app.get("/*", function(req, res)
  // {
      // var err = web + "error.html";
      // res.sendFile(err);
  // });
  
  io.sockets.on("connection", function(socket)
  {
      console.log(socket);
  });
  
  http.createServer(app).listen(8080);
  </code></pre>
  
  <p>index.html:</p>
  
  <pre><code>...&lt;script src="/socket.io/socket.io.js"&gt;&lt;/script&gt;...
  </code></pre>
  
  <p>and error: socket.io.js Failed to load resource: the server responded with a status of 404 (Not Found)</p>