title: How to add loading screen before rendering a page in Node.js?
body: <p>On the home page, I have a form. The <code>POST</code> action is performed after filling it out. In the <code>POST</code> event handler, I create a child process of execution of a python file with the given data in the form. The child process returns a promise and after it is returned, I render the required page. Until the page is rendered, the browser shows a loading animation beside the URL field (the reload button keeps spinning). I have designed my own loading animation and until the page is rendered, I want that animation to run on the page. Where in the script, should I add the function to do it?</p>
  
  <pre><code>index.post("/", function (request, response) {
  
      let my_url = "" + request.body.my_url + "";
  
      let py_program = spawn(pyInterpreter, ["run_algorithms/summarize_with_url.py", my_url]);
  
      py_program.stdout.on("data", data  =&gt; {
  
          console.log("Summary generated!");
          response.render("home.ejs", {summary: data.toString()});
  
      });
  });
  </code></pre>
  
  <p>Edit (Little Clarity): 
  The python script takes around 15 seconds to run. So, the page won't be rendered until it finishes. So, the client-side js files won't load as they are included in the to-be-rendered page. I want to display an animation until the server responds.</p>