title: Node JS: 500 Server Error
body: <p>I am kinda new to this node js thing. So, please bear with me.</p>
  
  <p>I have got a json string array in dotNetFin.js. I am not sure as to why error comes up(when i switch over to About page), and, in the command prompt window, it shows up "Undefined is not a function"</p>
  
  <p>Also, everything works fine if I include that json array in app.js.</p>
  
  <p>Well here is my code:</p>
  
  <p><strong><em>app.js</em></strong> </p>
  
  <pre><code>var express = require('express');
  
  var app = express();
  app.set('port', process.env.PORT || 3000);
  
  app.get('/', function (req, res) {
      res.render('home');
  });
  
  var teamData = require('./dotnetFin.js');
  app.get('/about', function (req, res) {
      res.render('about', { dotnet: teamData.getTeamData() });
  });
  //custom 404 page
  app.use(function (req, res) {
      res.type('text/plain');
      res.status(404);
      res.send('404 Not Found');
  });
  
  app.use(function (err, req, res, next) {
      console.log(err.stack);
      res.type('text/plain');
      res.status(500);
      res.send('500 Server Error');
  });
  
  app.listen(app.get('port'), function () {
      console.log('Express started on server' + app.get('port'));
  });
  
  var handleBars = require('express3-handlebars').create({ defaultLayout: 'main' });
  app.engine('handlebars', handleBars.engine);
  app.set('view engine', 'handlebars');
  </code></pre>
  
  <p><strong><em>dotnetFin.js</em></strong></p>
  
  <pre><code>var dotnetTeam = ["V",  
                          "M", 
                          "A",  
                          "H", 
                          "A", 
                          "G", 
                          "K"];
  
  var getTeamData = function () {
      return dotnetTeam;
  };
  </code></pre>
  
  <p><strong><em>main.handlebars</em></strong></p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;h2&gt;Fin&lt;/h2&gt;
    &lt;/head&gt;
    &lt;body&gt;
      {{{body}}}
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong><em>about.handlebars</em></strong></p>
  
  <pre><code>&lt;h1&gt;About Fin&lt;/h1&gt;
  &lt;h2&gt;Dotnet Team&lt;/h2&gt;
  &lt;h3&gt;{{dotnet}}&lt;/h3&gt; 
  </code></pre>
  
  <p><strong><em>Error Snapshot:</em></strong></p>
  
  <p><a href="https://i.stack.imgur.com/wLcaR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wLcaR.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/506iH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/506iH.png" alt="enter image description here"></a></p>