title: Node JS res.sendFile() not working
body: <p>I'm getting <code>ReferenceError: main is not defined</code>
  when I open up the <a href="http://localhost:3000/" rel="nofollow noreferrer">http://localhost:3000/</a></p>
  
  <p>Here I try to open up the main.html located in views directory</p>
  
  <p><strong>This is my app.js</strong> </p>
  
  <pre><code>const express = require('express'),
    app = express(),
    config = require('./config/index'),
    routes = require('./routes/route');
  
  app.use(express.static(`${__dirname}/public`));
  app.use(express.static(`${__dirname}/views`));
  app.use('/',routes);
  app.listen(config.port,()=&gt;{
  console.log(`Listing at port ${config.port}`)})
  </code></pre>
  
  <p><strong>This is my route.js</strong></p>
  
  <pre><code>const express = require('express'),
  router = express.Router(),
  helpers = require('../helpers/index');
  
  router.route('/')
  .get(helpers.index)
  
  module.exports = router
  </code></pre>
  
  <p><strong>This is my helpers/index.js</strong></p>
  
  <pre><code>var user = require('../user/user');
  
  exports.index = (req,res)=&gt;{
      if(user.name == ''){
          res.sendFile(main.html);
      }
      else{    
          res.sendFile(chat.html)
      }
  }
  
  module.exports = exports;   
  </code></pre>
  
  <p><strong>Directory Structure</strong></p>
  
  <pre><code>&gt;helpers
    &gt;index.js
  &gt;routes
    &gt;route.js
  &gt;user
    &gt;user.js
  &gt;views
    &gt;main.html
    &gt;chat.html
  app.js
  pacakage.json
  </code></pre>