Hi.
I'm trying to write my own web framework in C++ as a learning exercise and I seem to have run into a wall:
Basically, I was trying to write something like PHP's Code Igniter where, essentially, you route all the URIs to the index file, and from that index, you start the correct class (controller) based on that URI.
So, basically a "page" is represented by a class/method.
In C++, that would be impossible as it's impossible to alter the program's structure at runtime. There's no equivalent of eval(), nor would such a function make sense in a language like C++.
So, anyway, how would you go about doing it? My other alternative is to simply compile a file per group of pages, then divide them with IFs or switch-case statements page, and so if you type www.example.com/foo/bar in the browser, CGI would take you to a compiled file goo and then to a case (as in switch-case) "bar".
Are there better ways?
It's a very general question, and I apologize but I'm trying to figure out how to do it in a more professional way.