title: Getting node.js to read files in html format
body: <p>I am developing a small app in Node.js. I am just using Node.js for input and output.  The actual website is just running through nginx. The website has a Websocket connection with node.js and is primarily used for db manipulations.</p>
  
  <p>One of the things I am trying to do is get node to send small pieces of html along with the data from the database. I tried the following code.</p>
  
  <p>simplified:</p>
  
  <pre><code>    connection.on('message', function(message) {
          fs.readFile(__dirname + '/views/user.html', function(err, html){
  
              if(err){
                  console.log(err);
              }else{
                  connection.sendUTF( JSON.stringify({
                      content: html,
                      data: {}
                  }));
              }
          });
      }
  });
  </code></pre>
  
  <p>When I <code>console.log(html)</code> on the server or in the client I only get numbers back.</p>
  
  <p>Anyone know what could be wrong.</p>
  
  <p><strong>NOTE:</strong> <em>I really want to stay away from stuff like <code>socket.io</code>, <code>express</code>, etc. Just keeping it as simple as possible and no fallbacks are needed.</em></p>