title: Why won't the following Node JS code refuse to serve a STATIC png file?
body: <p>To Admins, I have spent the whole day searching, trying and retrying many different answers dealing with Node Js, Express and Static files I found all over stackoverflow and on the internet and I still have not found a single piece of code or hints or clues that help me one bit. So, if this question that I am asking is very similar or duplicate to others, I apologize. I am frustrated.</p>
  <p>Having said that I searched online for a very very simple EXAMPLE of what I am trying to do. Then, I followed the tutorial to the TEETH and still it won't work as expected. All I want to be able to do is have NodeJs server serve static files like images and javascript. Here is the code.</p>
  <p>NodeJS or Server.js</p>
  <pre><code>const express = require('express');
  const app = express();
  const PORT = 3000;
  
  app.use(express.static('public'));
  
  app.get('/', (req, res) =&gt; {
      res.send('Hello World!'); &lt;--- This does not load index.html.
  });
  
  //app.get(&quot;/&quot;,function(req,res){
  //    res.sendFile(__dirname + '/index.html'); &lt;---this what I added to load index.html
  //});
  
  app.listen(PORT, () =&gt; console.log(`Server listening on port: ${PORT}`));
  </code></pre>
  <p>index.html</p>
  <pre><code>  &lt;html&gt;
    &lt;head&gt;
    &lt;title&gt;Hello World!&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
    &lt;h1&gt;Hello, World!&lt;/h1&gt;
    &lt;img src=&quot;shark.png&quot; alt=&quot;shark&quot;&gt;
    &lt;/body&gt;
    &lt;/html&gt;
  </code></pre>
  <p>The interesting thing about this simple code is that on the client side (Browser) there is not a single error in the console.</p>
  <p>So, what is wrong with this code? Why is this code refuseing to serve simple image file?</p>