title: 'Uncaught SyntaxError: Unexpected token <' in Node.js
body: <p>I am getting the below screen-shot error when I try to serve my client-side code. When I am trying to run <code>node server/server.js</code>:</p>
  <p><a href="https://i.stack.imgur.com/xcumU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xcumU.png" alt="Enter image description here" /></a></p>
  <p>The below is my <em>server.js</em> code...</p>
  <pre><code>app.use(express.static(path.join(__dirname, &quot;public&quot;)));
  app.use(logger('dev'));
  app.use(bodyParser.json({limit: '50mb'}));
  
  app.all('/*', function(req, res, next){
      res.header(&quot;Access-Control-Allow-Origin&quot;, &quot;*&quot;);
      res.header(&quot;Access-Control-Allow-Methods&quot;, &quot;GET, PUT, POST, DELETE, OPTIONS&quot;);
      res.header(&quot;Access-Control-Allow-Headers&quot;, &quot;Content-type,Accept,X-Access-Token,X-Key&quot;);
  
      if(req.method === 'OPTIONS'){
          res.status(200).end();
      } else {
          next();
      }
  
  });
  
  app.all(&quot;/api/v1/*&quot;, [require('./middlewares/validateRequest')]);
  app.use(&quot;/&quot;, require(&quot;./routes&quot;));
  
  app.use(function(req, res, next){
      var err = new Error(&quot;Not found&quot;);
      err.status = 404;
      next(err);
  });
  </code></pre>
  <p>Inside my <code>routes/index.js</code>, I have the following for <code>get request</code>.</p>
  <pre><code>router.get('*', function(req, res) {
      res.sendfile('./public/index.html');
  });
  </code></pre>