title: Deploying nodejs app on a web server
body: <p>I am new to NodeJS and learning, I want to know how to make an sample app using NodeJS.
  I have tried it on localhost and it is working. Now I am trying to host it public to any server, but it is not working.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var http = require('http');
  http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello World\n');
  }).listen(1337, '127.0.0.1');
  console.log('Server running at http://127.0.0.1/');</code></pre>
  </div>
  </div>
  </p>
  
  <p>This is code is saved in my local machine as m.js, I run: </p>
  
  <pre><code>$ node m.js
  </code></pre>
  
  <p>It runs fine  and when i open it in browser as <a href="https://127.0.0.1:1337" rel="nofollow">https://127.0.0.1:1337</a></p>
  
  <p>I am getting the output as :</p>
  
  <pre><code>Hello World
  </code></pre>
  
  <p>I want the same thing to do from a remote server i.e. I have a domain <code>www.example.com</code> and if I open it with <a href="https://www.example.com:1337" rel="nofollow">https://www.example.com:1337</a>
  then it should show on my browser screen like previously : </p>
  
  <pre><code>Hello World
  </code></pre>
  
  <p>But it is not working.</p>