I've got a Windows application coded in C++. I want to provide a web-based interface to them, with a view to porting them to embedded Linux systems. The web pages are a series of dynamic 'status pages' into the system, with possibly some simple interaction controls
Modern HTML/CSS/Web technologies are all comparatively new to me, and I'm trying to work out a sane approach to structure this.
The first approach was using a simple webserver integrated straight into the Windows application, with some C++ code writing the HTML dynamically, and serving some static css/javascript/images. Pitfalls were pretty obvious: No HTTPS, content and presentation all muddled together :(
Now, I have 'static' pages which use JQuery to retrieve JSON data from my app. The server now is nginx, and it uses FastCGI to pull data from my app.
So the process is a bit like this:
- Browser requests page
- Nginx serves page with Javascript
- Browser executes javascript and uses JQuery/getJSON to fetch status data
- Nginx forwards JSON GET via fastcgi to my app
- My app generates JSON and sends to nginx
- Nginx forwards JSON to browser
- Browser javascript uses JSON data to render page
This seems a little cumbersome. Is there something smarter I should be doing, maybe using server-side includes with fastcgi to include the JSON data in the original request? Am I doing something horribly unconventional?