Search code examples
javascriptnode.jsuipathprerenderuipath-robot

Prerender javascript framework UiPathRobot.js on server side is not working


From Prerender tool:

Google, Facebook, Twitter, Yahoo, and Bing are constantly trying to view your website... but they don't execute javascript. That's why we built Prerender. Prerender is perfect for AngularJS SEO, BackboneJS SEO, EmberJS SEO, and any other javascript framework.

Referring to this article. I try to run the UiPathRobot.js on my server. But currently that framework is always executed client-side. This does not make any sense. So I tried to let it run on the server and found prerender-node package on node.js.

But I tried so much and it was not working or it still executed client-side. So this is the basic setup that I use:

const express = require('express');
const prerender = require('prerender-node');
const app = express();
app.use(prerender());
app.get('*', (req, res) => {
  res.sendFile('C:\\Users\\name\\Documents\\Git\\rpa_robotjs\\index.html');
});
app.listen(6543);

What to add now, so that it shows up a prerendered version of:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="/css/styles.css"> 
    <script type="text/javascript" src="scripts/UiPathRobot.js"></script>
    <script type="text/javascript" src="scripts/helper.js"></script>
  </head>
  <body>
    <header>
      <div class="container">
        <img src="/images/logo.png" alt="logo" class="logo-image">
        <span class="logo-text">PROEJCT</span>
      </div>
      <div class="subcontainer">
        <h1>Robot Process Automation</h1>
      </div>
    </header>
    <main>
      <article>
        <h2>Overview of processes</h2>
        <div id="port"></div>
        <div id="username"></div>
        <div id="error-message"></div>
        <div id="robot-status"></div>
        <table>
          <tr>
            <td valign="top">
              <div id="divRobots" style ="border: 1px solid black;"></div>
              <button style="margin-top: 10px;" id="GetRobotProcesses" onclick="refreshRobotProcesses();">Refresh Robot Process</button>    
            </td>
          </tr>
        </table>
      </article>
    </main>
  </body>
</html>

So first question is how the UiPathRobot.js is executed server-side?


Solution

  • Well the question was non-sense I must say. I found out that UiPathRobot.js needs to run on the same machine where it is accessed.

    So any question about security does not make sense. It has no security at all because it does not need some.

    For the case you look for having a real server with a frontend, check out the node.js version of Orchestrator. This works well and is very safe as it runs completely on server-side and only the frontend is shown to the user.