title: Node express server not serving images folder
body: <p>When I run my bundled React app on the production server, it can't find my image files and I'm not sure why. I'm fairly sure it's got something to do with my node express configuration and/or my <code>.ejs</code> template file.</p>
  
  <p><strong>server.js</strong></p>
  
  <pre><code>var express = require('express')
  var app = express();
  const path = require('path');
  
  app.use('/static', express.static(__dirname + '/static'));
  
  app.set('views', __dirname + '/views');
  app.set('view engine', 'ejs');
  
  app.get('*', function (req, res) {
      res.render("index");
  });
  
  const port = process.env.PORT || 3000;
  const env = process.env.NODE_ENV || 'production';
  app.listen(port, err =&gt; {
    if (err) {
      return console.error(err);
    }
    console.info(`Server running on http://localhost:${port} [${env}]`);
  });
  </code></pre>
  
  <p><strong>index.ejs</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8" /&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
      &lt;title&gt;Production Server&lt;/title&gt;
      &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"&gt;
      &lt;link href="https://fonts.googleapis.com/css?family=BenchNine" rel="stylesheet"&gt;
      &lt;link rel="stylesheet" href="../static/css/main.css"&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;div id="root"&gt;&lt;/div&gt;
      &lt;script src="../static/js/bundle.js"&gt;&lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My CSS stylesheet is called in the template file, and all JS is bundled into <code>bundle.js</code> which is referenced in the script tag. I'm not sure how to get my application to recognise the <code>/img</code> folder though, as at the moment it doesn't.</p>
  
  <p>Here's my file structure:</p>
  
  <pre><code>- static
     - css
        - main.css
     - js
        - bundle.js
     - img (contains all image files)
  </code></pre>
  
  <p>When I run the app however, and I open 'Sources' in Chrome console, the /img file is not being served. </p>
  
  <p>I thought this line indicates that express serves everything in the <code>/static</code> folder...</p>
  
  <pre><code>app.use('/static', express.static(__dirname + '/static')); 
  </code></pre>
  
  <p>...yet only two out of three files are being served.</p>
  
  <p>Would massively appreciate if anyone can tell me where I'm going wrong with my setup.</p>
  
  <p>Thanks in advance.</p>