title: Node server returning only index.html don't load bundle.js or other js files
body: <p>Hello stackoverflow members,</p>
  
  <p>this is my first question, so please be gentle.</p>
  
  <p>Currently I've an Amazon-web-service(AWS) server which is runing of node.js.
  I've copied the node.js file from AWS the example project for node.js.</p>
  
  <pre><code>////node.js
  var port = process.env.PORT || 3666,
      http = require('http'),
      fs = require('fs'),
      html = fs.readFileSync('index.html');
  
  var log = function(entry) {
      fs.appendFileSync('/tmp/sample-app.log', new Date().toISOString() + ' - ' + entry + '\n');
  };
  var server = http.createServer(function (req, res) {
      if (req.method === 'POST') {
          var body = '';
  
          req.on('data', function(chunk) {
              body += chunk;
          });
  
          req.on('end', function() {
              if (req.url === '/') {
                  log('Received message: ' + body);
              } else if (req.url = '/scheduled') {
                  log('Received task ' + req.headers['x-aws-sqsd-taskname'] + ' scheduled at ' + req.headers['x-aws-sqsd-scheduled-at']);
              }
  
              res.writeHead(200, 'OK', {'Content-Type': 'text/plain'});
              res.end();
          });
      } else {
          res.writeHead(200);
          res.write(html);
          res.end();
      }
  });
  
  // Listen on port 3000, IP defaults to 127.0.0.1
  server.listen(port);
  
  // Put a friendly message on the terminal
  console.log('Server running at http://127.0.0.1:' + port + '/');
  </code></pre>
  
  <p>How I writed in the header I get only the index.html.
  This is how it look it in the console</p>
  
  <blockquote>
    <p>bundle.js:1 Uncaught SyntaxError: Unexpected token  &lt;</p>
  </blockquote>
  
  <p>If I open bundle.js in network tab(from chrome) there is only the code from the index.html</p>
  
  <pre><code>////index.html 
  &lt;!doctype html&gt;
  &lt;html class="no-js" lang="ger" dir="ltr"&gt;
  
  &lt;head&gt;
      &lt;meta charset="UTF-8" /&gt;
      &lt;meta http-equiv="x-ua-compatible" content="ie=edge"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0" /&gt;
  
      &lt;script type="text/javascript" src="bundle.js" charset="utf-8"&gt;&lt;/script&gt;
      &lt;script src="https://sdk.amazonaws.com/js/aws-sdk-2.6.7.js" type="application/javascript"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;test&lt;/h1&gt;
  
  &lt;div ng-view&gt;&lt;/div&gt;
  &lt;script&gt;
              $(document).foundation();
      &lt;/script&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/33260093">Node JS and Webpack Unexpected token &lt;</a>
  Here had an other person the same problem(probably), but how far I've understand they've only recommended an other server application(Express)? 
  But cause I use AWS I can only use node.js </p>
  
  <p>It has nothing to do with the bundle.js this problem has any JavaScript file.</p>
  
  <p>I've no experince with node.js, I only wish to load Javascript files.</p>
  
  <p>A walkaround: I can use and load correctly http calls. But this is extrem time consuming. I need to load all Js files(even my modul Controller) on my AWS s3 bucket.</p>
  
  <p>It's a single page application that has many custom Javascript files und modules.  <a href="https://i.stack.imgur.com/LJLUR.png" rel="nofollow noreferrer">Here a screenshot from my directory</a></p>
  
  <p>I looking forward to your answers!</p>