Best architecture for passing data from backend to frontend [closed]

  architecture, javascript, jquery, php, ros

I am working on a website that serves as a UI for controlling a mobile robot. I inherited this from a colleague who left, and I am trying to get my head around it.

The website is built on PHP and JavaScript. It also features an SQL database which was created with MyPHPAdmin. It also uses Leaflet (for map visualization) and jQuery.

I need to plot the mobile robot’s positions on the map (among other things), and for that I have found the ROSLib library, which can be used to obtain ROS topics in order to display them on a frontend (an example which I am planning to use is here). However, I am not sure on which architecture model I should use, as I am not experienced with web development. Should I

  1. Develop a separate node.js server which will run in parallel, that listens to the ROS messages and forwards them to custom-created routes, in order for the frontend app to access them (e.g. localhost:5050/robot/coordinates) ?
  2. Put the example code in index.php and find a way of making the data accessible by all pages in the website? (Note: I tried this and I am able to receive data from ROS, but could not figure out how to share data to the map.html page)

Thanks in advance.

Source: Ask Javascript Questions

LEAVE A COMMENT