title: Running Node JS server on localhost
body: <p>I want to make a very simple web server like this for example.</p>
  
  <pre><code>const http = require('http');
  
  http.createServer(function (req, res) {
      res.writeHead(200, {
          'Content-Type': 'text/plain'
      });
      res.write("Hello!");
      res.end();
  }).listen(8080);
  </code></pre>
  
  <p>I put this code in WebStorm and ran it. Then I put in the same directory index.html file.</p>
  
  <pre><code>&lt;body&gt;
      &lt;button id="btn"&gt;Click Me&lt;/button&gt;
      &lt;script src="https://code.jquery.com/jquery-3.2.1.js"&gt;&lt;/script&gt;
      &lt;script src="requester.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>I also put requester.js file in the same folder.</p>
  
  <pre><code>$('#btn').on("click", function () {
      $.get('/', function () {
          console.log('Successful.');
      });
  });
  </code></pre>
  
  <p>Then I execute command live-server in this folder where all files are. I don't know how to make the server to work on localhost. Thank you in advance.</p>