title: index.jade is not appearing on localhost
body: <p>I have been following this tutorial on building a web app and database using node.js, express and jade.<br>
      <a href="https://cozy.io/en/hack/getting-started/first-app.html" rel="nofollow">https://cozy.io/en/hack/getting-started/first-app.html</a><br>
  Despite laying out everything the same, my index.jade is not loading on localhost. There are no errors to suggest why on browser terminal. I have checked that my environment variables are set up, and I have altered the filepaths to index.jade, but it has not made any difference, just a white screen. On my command prompt, the server is listening and the database is connected.</p>
  
  <pre><code>My environment folder is   
  C:\foodshop and within this I have  
  node_modules,   
  index.jade,   
  package.json,   
  shopDB.db,   
  simpleserver.js
  </code></pre>
  
  <p>simpleserver.js contains the following - </p>
  
  <pre><code>// This is the server.
  var http = require('http'),
      express = require('express'),
      app = express(),
      sqlite3 = require('sqlite3').verbose(),
      db = new sqlite3.Database('shopDB.db', (function(err) {
          if (!err) {
              console.log("Database is connected ... \n\n");
          } else {
              console.log("Error connecting database, check for shopDB.db file... \n\n");
          }
      }));
  
  /* We add configure directive to tell express to use Jade to                   
     render templates */
  app.get('env', (function() {
      app.set('views', __dirname + '');
      app.engine('.html', require('jade').__express);
  
      // Allows express to get data from POST requests
      app.use(express.bodyParser());
  }));
  
  // Database initialization (First list names of tables and check if currently exists.)                                                 
  db.get("SELECT name FROM sqlite_master WHERE type='table' AND name='itemList'", function(err, row) {
      if (err !== null) {
          console.log(err);
      } else if (row == null) {
          db.run('CREATE TABLE IF NOT EXISTS  "itemList" ("ID" INTEGER PRIMARY KEY NOT NULL, "itemName" VARCHAR(100) NOT NULL, "itemWeight" INT(5) NOT NULL, "expiryDate" DATE, "itemPrice" double DEFAULT NULL)', function(err) {
              if (err !== null) {
                  console.log(err);
              } else {
                  console.log("SQL Table 'itemList' initialized.");
              }
          });
      } else {
          console.log("SQL Table 'itemList' already initialized.");
      }
  });
  
  // We render the templates with the data                              
  app.get('/', function(req, res) {
  
      db.all('SELECT * FROM itemList ORDER BY itemName', function(err, row) {
          if (err !== null) {
              res.send(500, "An error has occurred -- " + err);
          } else {
              //res.sendfile('./public/index.html')
              res.render('./index.jade', {
                  itemList: row
              }, function(err, html) {
                  //res.sendfile('./index.jade')
                  //res.send(200, html);
                  res.status(200).send(html);
              });
          }
      });
  });
  
  // We define a new route that will handle item creation                      
  app.post('/add', function(req, res) {
  
      ID = req.body.ID;
      itemName = req.body.itemName;
      itemWeight = req.body.itemWeight;
      expiryDate = req.body.expiryDate;
      itemPrice = req.body.itemPrice;
  
      sqlRequest = "INSERT INTO 'itemList' (ID, itemName, itemWeight, expiryDate, itemPrice) VALUES('" + ID + "', '" + itemName + "', '" + itemWeight + "', '" + expiryDate + "', '" + itemPrice + "')"
      db.run(sqlRequest, function(err) {
          if (err !== null) {
              res.send(500, "An error has occurred -- " + err);
          } else {
              res.redirect('back');
          }
      });
  });
  
  // We define another route that will handle item deletion                     
  app.get('/delete/:itemName', function(req, res) {
      db.run("DELETE FROM itemList WHERE itemName='" + req.params.itemName + "'", function(err) {
          if (err !== null) {
              res.send(500, "An error has occurred -- " + err);
          } else {
              res.redirect('back');
          }
      });
  });
  
  /* This will allow Cozy to run your app smoothly but
   it won't break other execution environment */
  var port = process.env.PORT || 9250;
  var host = process.env.HOST || "127.0.0.1";
  
  // Starts the server itself
  var server = http.createServer(app).listen(port, host, function() {
      console.log("Server listening to %s:%d within %s environment",
          host, port, app.get('env'));
  }); 
  </code></pre>
  
  <p>And this is the index.jade file</p>
  
  <pre><code>doctype 5
  html(lang="en")
    head
      title Items
  
    body
  
  
      form(action="add", method="post")
          label ID:
          input(type="text", name="ID")
          label itemName:
          input(type="text", name="itemName")
          label itemWeight:
          input(type='text', name='itemWeight')
          label expiryDate:
          input(type='text', name='expiryDate')
          label itemPrice:
          input(type='text', name='itemPrice')
          input(type="submit", value="Add a new item")
  
      ul
          - for(item in itemList) {
              li
                  a(href=itemList[item].url)= itemList[item].itemName
                  | &amp;nbsp;- (
                  a(href="delete/#{itemList[item].id}") delete
                  | )
          - }
  </code></pre>