title: Declaration or Statement Expected (Javascript)
body: <p>I am currently having an issue where I  added a function in my Javascript server that is currently throwing an error.</p>
  <pre><code>var http = require('http');
  var fs = require('fs')
  
  
  var server = http.createServer(function (req, res){
  
      //handle incoming requests here
  
  
      if (req.url == '/') {
  
  
  
          res.writeHead(200, { 'Content-Type': 'text/html'}); //sets the headers for the response
  
          res.write('Welcome to project perfect'); //write an about me page
  
  
          res.end();
      }
      else if (req.url == '/spotify' ) {
          res.writeHead(200, { 'Content-Type': 'text/html'});
  
          fs.readFile('./index.html', function (err, data) {  //Figure out why the if logic is making line 39 error
              res.write(data);
              res.end();
          });
      
      
  </code></pre>
  <p>##The error is being thrown below in the else if statement.</p>
  <pre><code>    else if (req.url == '/fitness') {
          res.writeHead(200, {'Content-Type': 'text/html'});
  
          res.write(&quot;Welcome to aroe's fitness page&quot;); //integrate myfitnesspal api and workout recorder
  
          res.end();
      }
  
      else if (req.url == '/blog') {
  
          res.writeHead(200, {'Content-Type': 'text/html'});
          res.write('blog');
  
          res.end();
      }
  })
  server.listen(8000);
  
  console.log('SERVING ON PORT 8000')
  </code></pre>
  <p>The error is saying</p>
  <pre><code>declaration or statement expected at the this chunk `else if (req.url == '/fitness') {`
  </code></pre>
  <p>It only happened after I added the fs.fileread function. Something there is erroring out the next else if logic I present it. I am new to Javascript so I understand this may be trivial. Thanks for your help!</p>