title: execute server side functions on HTML button click
body: <p>I have built a small app using REACT and node.js to execute 2 .js files that</p>
  <ol>
  <li>Defines a set of functions as modules.</li>
  <li>Runs the modules sequentially.</li>
  </ol>
  <p>Serverside the app is providing the functionality to:</p>
  <ol>
  <li>Return the JSON of an Entry and save it as a .json file with the
  Entry UID as the file name.</li>
  <li>Copy the file for each language we
  support and append the locale code to the beginning of the name.</li>
  <li>Update each file's locale key with the corresponding locale code.</li>
  <li>Zip all of the files together in a folder named with the Entry's
  UID</li>
  </ol>
  <p>With all of this working I am trying to implement a button on the client side that runs the scripts and downloads zip file that is created.</p>
  <pre><code>    &lt;div&gt;
        &lt;h3&gt;Download This Entry For Localization&lt;/h3&gt;
          &lt;button id=&quot;downloadZip&quot;&gt;download&lt;/button&gt;
          &lt;script&gt;
  var appModule = require('./app_modules.js');
  
  download();
  
  function download(){
      first('first')
      .then(second)
      .then(third)
      .then(fourth)
      .then(fith)
      .then(sixth)
      .then(seventh); 
  }
          function first(a){
              return new Promise((resolve, reject) =&gt; {
                  appModule.getEntry()
                  resolve(a);  
              });
          }
  
          function second(b){
              return new Promise((resolve, reject) =&gt; {
                setTimeout(() =&gt; {
                        appModule.copyEntry()
                        resolve(b);
                }, 2000);  
              });
          
          }
  
          function third(c){
              return new Promise((resolve, reject) =&gt; {
                setTimeout(() =&gt; {
                        appModule.updateEntry()
                        resolve(c);
                }, 2000);  
              });
          
          }
  
          function fourth(d){
              return new Promise((resolve, reject) =&gt; {
                setTimeout(() =&gt; {
                        appModule.zipEntry()
                        resolve(d);
                }, 2000);  
              });
          
          }
  
          function fith(e){
              return new Promise((resolve, reject) =&gt; {
                setTimeout(() =&gt; {
                        appModule.cleanEntry()
                        resolve(e);
                }, 2000);  
              });
          
          }
  
          function sixth(f){
              return new Promise((resolve, reject) =&gt; {
                setTimeout(() =&gt; {
                        appModule.cleanCopies()
                        resolve(f);
                }, 2000);  
              });
          
          }
  
          function seventh(f){
              return new Promise((resolve, reject) =&gt; {
                setTimeout(() =&gt; {
                        appModule.downloadZip()
                        resolve(f);
                }, 2000);  
              });
          
          }
          let btn = document.getElementById(&quot;downloadZip&quot;);
          btn.addEventListener('click', event =&gt; {
            download();
          });
          &lt;/script&gt;
      &lt;/div&gt;
  </code></pre>
  <p>I am sure this is some combination of react and express but I am stuck. any help would be greatly appreciated.</p>