title: How to call a function from HTML to a Javascript file, in Node.JS
body: <p>I am using Node.JS with Express. The following line fails, and I need help fixing it. </p>
  
  <pre><code>var routines = require("myJsRoutines.js");
  </code></pre>
  
  <p>When I run index.html and click <code>MenuItem</code>, I get the first alert, but not the second one.
  I have both files in the same directory. Thanks</p>
  
  <p>index.html:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Test&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;a href="javascript:myMenuFunc('Level 1');"&gt;MenuItem&lt;/a&gt;
      &lt;script&gt;function myMenuFunc(level) {
          alert("myMenuFunc1:" + level);
          var routines = require("myJsRoutines.js");
          alert("myMenuFunc:2" + level);
          routines.processClick(level);
          alert("myMenuFunc:3" + level);
      }&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>myJsRoutines.js:</p>
  
  <pre><code>exports.processClick = function processClick (param1) {
      console.log(param1)
  }
  </code></pre>