title: JavaScript and CSS files not linking in App (using Express)
body: <p>Can someone please help me to understand what I am doing wrong with my code.  Why won't my javascript or css file run when it is the server that sends the index.html file to the browser? </p>
  
  <p>I have a very basic html page, javascript page, and express server.  I am confused about something.  If I get access to the html by starting the app and then typing: localhost:3000 in my url bar, the browser is served with the index.html as expected.  However, none of the scripts in my javascript work (none of the console.logs run, and the event-handlers are not attached).   On the other hand, if I paste the absolute file-path into the url bar (with or without the server running), the scripts.js file <em>does</em> work.</p>
  
  <p>Here are my basic files:</p>
  
  <p>index.html</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;music&lt;/title&gt;
      &lt;link rel="stylesheet" type="text/css" href="style.css"&gt;
      &lt;script src="scripts.js"&gt;&lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;p&gt;I am the html&lt;/p&gt;
  
      &lt;button id="myButton"&gt;click here&lt;/button&gt;
  
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>scripts.js:</p>
  
  <blockquote>
    <p>window.onload = function(e) {    console.log('js file is loaded');<br>
    let button = document.getElementById('myButton');<br>
    button.addEventListener('click', function(e) {
          console.log('the button was clicked');   }); };</p>
  </blockquote>
  
  <p>app.js</p>
  
  <blockquote>
    <p>const express = require('express'); const app = express();</p>
    
    <p>app.get('/', function (req, res) {<br>
    res.sendFile('/Users/myName/webPage/index.html');
    });</p>
    
    <p>app.listen(3000);</p>
  </blockquote>
  
  <p>start server with: nodemon app.js</p>
  
  <p>Thank you!</p>