title: Node.js Express res.json to html page?
body: <p>I've a small app, that sends all kind of error messages to client if something goes wrong, basically json messages.</p>
  
  <p>Is it possible to somehow render those messages to a HTML page?</p>
  
  <p>For example, I've simple login form with username and password, I send it back to node.js </p>
  
  <pre><code>app.post('/login', function (req, res) {
      var username = req.body.username; // etc...
      if (username === "George" &amp;&amp; password === "cat") {
          res.json({message : "success"});    
      } else {
          res.json({message : "fail"});
      }
  });
  </code></pre>
  
  <p>Naturally, it sends a page with nothing but json on it. Of course. How can I catch these messages? Can I even catch them? Is this even good design? I know about flash messages, I've used them couple of times. I also do know that I should use jQuery's .ajax function for this, but I couldn't make it work. </p>
  
  <p>I appreciate your input, truly. </p>