title: How to pass query result data to the view in Express.js and Mysql
body: <p>I am trying to display my query result in my view,but nothing seems to be working as i m new to this , I can see the result in the console log but not on my html file 3</p>
  
  <pre><code>var express = require('express');
  var router = express.Router();
  
  var connection = require('../connection');
  
  /* GET home page. */
  router.get('/', function(req, res, next) {
  
  connection.query('SELECT * FROM articles',function(error,results,fields){
   if(error) throw error;
  
    console.log('Data received from Db:\n');
    console.log(results);
  
    res.render('index', {data:results,error:null});
     });
  
  
  
  });
  
   module.exports = router;
  </code></pre>
  
  <p>and my view is </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
   &lt;head&gt;
   &lt;title&gt;&lt;/title&gt;
   &lt;link rel='stylesheet' href='/stylesheets/style.css' /&gt;
    &lt;/head&gt;
    &lt;body&gt;
    &lt;h1&gt;test&lt;/h1&gt;
    &lt;p&gt;Welcome to &lt;%= ??????? %&gt; &lt;/p&gt;
    &lt;/body&gt;
    &lt;/html&gt;
  </code></pre>
  
  <p>Thanks</p>