title: Node-Webkit mysql data to news feed
body: <p>I working on a news feed tool that we can send remote news messages to a screen. Now i have done the back end of the system and working now on the frontend/client.</p>
  
  <p>I will use node-web kit to show the news on the screen. I have already a connection with the database and it show the messages also in the console log. But i don't get it right to show it on the news feed page.</p>
  
  <p>I try to make it looks like a CNN news feed banner:
  <a href="https://i.stack.imgur.com/ZkLEb.jpg" rel="nofollow noreferrer">CNN feed banner</a></p>
  
  <p>Styling is not the problem but i don't get the date from the json (mysql output) to the screen.</p>
  
  <p>The output i get from mysql in the console looks like:</p>
  
  <pre><code>[{"id":1,"message":"Test message #1"},{"id":2,"message":"Test message #2"},{"id":3,"message":"Test message #3"}] 
  </code></pre>
  
  <p>And the code from the client looks like:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;NewsFeed&lt;/title&gt;
  
    &lt;script&gt;
  
    var mysql      = require('mysql');
    var connection = mysql.createConnection({
      host     : 'XXXXX',
      user     : 'XXXXX',
      password : '',
      database : 'XXXXX'
    });
  
    connection.connect(function(err) {
      if (err) {
        console.error('error connecting: ' + err.stack);
        return;
      }
  
      connection.query('SELECT * FROM message', function (error, results, fields) {
        if (error) throw error;
        json = JSON.stringify(results);
        console.log(json);
      });
    });
  
    &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
    &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Do someone know how to read the Json information from the console to the HTML view?</p>
  
  <p>And also is there a way the let the news feed automatic update when there is add a new message to the database? </p>
  
  <p>UPDATE: I think auto refresh is not the best way. So i was thinking about remote refresh. The idea is;</p>
  
  <p>User login on a backend system add a message and then press on a button to reload the page.</p>
  
  <p>Like this image: <a href="https://i.imgur.com/zoDCL7o.jpg" rel="nofollow noreferrer">Idea reload remote</a></p>