title: Node.js. Why is the page cannot load css and javascript file?
body: <p>i have created a node.js server. When i entered the localhost using port 3000, it displayed text only without css or javascript. I have tried several solutions that have worked on others. but they didn't worked for me.</p>
  
  <p><a href="https://stackoverflow.com/questions/17775944/node-js-keep-getting-failed-to-load-resource-error-message">Node JS keep getting Failed to load resource error message</a></p>
  
  <p><a href="https://stackoverflow.com/questions/10434001/static-files-with-express-js">static files with express.js</a></p>
  
  <p><a href="https://stackoverflow.com/questions/13395742/can-not-get-css-file">Can not get CSS file</a></p>
  
  <p>my file order is like this</p>
  
  <pre><code>server.js
  index.html
   public
    css
     style.css
  </code></pre>
  
  <p>This is the code for the server</p>
  
  <pre><code>var express = require('express');
  var app = express();
  app.get('/', function(req, res) {
  res.sendFile(__dirname + '/index.html');});
  app.use(express.static(__dirname + 'public'));
  app.listen(3000);
  </code></pre>
  
  <p>These are the errors</p>
  
  <pre><code>GET http://localhost:3000/ [HTTP/1.1 304 Not Modified 11ms]
  GET http://localhost:3000/public/css/demo.css [HTTP/1.1 404 Not Found 10ms]
  GET http://localhost:3000/public/css/themes/popclip.css [HTTP/1.1 404 Not Found 10ms]
  GET http://localhost:3000/public/css/reveal.min.css [HTTP/1.1 404 Not Found 19ms]
  GET http://localhost:3000/public/css/theme/default.css [HTTP/1.1 404 Not Found 12ms]
  GET http://localhost:3000/public/css/jquery.dropdown.css [HTTP/1.1 404 Not Found 11ms]
  GET http://localhost:3000/node_modules/socket.io/node_modules/socket.io-client/socket.io.js [HTTP/1.1 404 Not Found 10ms]
  GET http://localhost:3000/public/js/jquery.min.js [HTTP/1.1 404 Not Found 29ms]
  GET http://localhost:3000/public/js/jquery.popline.js [HTTP/1.1 404 Not Found 28ms]
  GET http://localhost:3000/public/js/plugins/jquery.popline.link.js [HTTP/1.1 404 Not Found 28ms]
  </code></pre>