title: How to pass a variable from Express to Jade
body: <p>I am using IBM Bluemix to make a web service for a school project.</p>
  
  <p>I need to pass some variables from the .js to the .jade file, but I am having trouble in doing so.</p>
  
  <p>I know I have to declare an object which hold the variables and then use </p>
  
  <pre><code>#{Variable}
  </code></pre>
  
  <p>in the Jade Template, but I can't figure out why this method is not working on my code.</p>
  
  <p>What could be the cause of this problem and how is it possible to solve it?</p>
  
  <p>Here is my .js code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>/*eslint-env node*/
  
  //------------------------------------------------------------------------------
  // node.js starter application for Bluemix
  //------------------------------------------------------------------------------
  
  // HTTP request - duas alternativas
  var http = require('http');
  var request = require('request');
  
  // cfenv provides access to your Cloud Foundry environment
  // for more info, see: https://www.npmjs.com/package/cfenv
  var cfenv = require('cfenv');
  
  //chama o express, que abre o servidor
  var express = require('express');
  
  // create a new express server 
  var app = express();
  
  // serve the files out of ./public as our main files
  app.use(express.static(__dirname + '/public'));
  
  // get the app environment from Cloud Foundry
  var appEnv = cfenv.getAppEnv();
  
  // start server on the specified port and binding host
  app.listen(appEnv.port, '0.0.0.0', function() {
      // print a message when the server starts listening
      console.log("server starting on " + appEnv.url);
  });
  
  
  app.get('/home1', function (req,res) {
      http.get('http://developers.agenciaideias.com.br/cotacoes/json', function (res2) {
          var body = '';
          res2.on('data', function (chunk) {
              body += chunk;
          });
          res2.on('end', function () {
              var json = JSON.parse(body);
              var cotacao = json["bovespa"]["cotacao"];
              var UsdValue = json["dolar"]["cotacao"];
              var UsdVariation = json["dolar"]["variacao"];
              var CotacaoEuro = json["euro"]["cotacao"];
              var VariacaoEuro = json["euro"]["variacao"];
              var TimeOfUpdate = json["atualizacao"];
     
     res.render('cotacao_response.jade', {
                   'UsdValue':UsdValue,
       'TimeOfUpdate':TimeOfUpdate,
       'UsdVariation':UsdVariation
              });
          });
      });
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is my .jade code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>doctype html
  html(lang="en")
    head
      title Cotação 
      link(rel='stylesheet',href='stylesheets/style.css')
    body
    h1 Your exchange rate is #{UsdValue}. 
    h1 The variation was #{UsdVariation}%.
    p The values were updated in !{TimeOfUpdate}.
    #container.col
    p 
    p.
          </code></pre>
  </div>
  </div>
  </p>