Help with setting up RESTful API type of setups using C under linux? [View all]
So my boss wants to update how we do some things, and he wants to setup part of the system RESTfully, but reusing most of the code we've already got, which are .cgi scripts written up in C. I've started going through and converting all of my error setup to use the HTTP errors, while dumping my output back as JSON arrays, rather than webpages.
But my cgi files are still cgi files, all sitting in the cgi directory. I can't figure out how to word my google searches to bring up what I'm trying to find out, which is how to map incoming requests, so that, for instance, a GET to www.example.com/users/12?session=34534545 goes to my user_manager.cgi script in view mode for user number 12, while a PUT to www.example.com/users/12?session=34534545 goes to it in update mode, or a POST to www.example.com/users/12/orders goes to write_order.cgi and writes up a new order for user 12.
Do I have to write up some sort of parsing script that pulls apart everything after every incoming request, figures out which script it needs to hit and then calls that script with all of the variables being sent along? Or are there (surely!) plugin modules for apache2 servers that do what I need doing, that I can just add some routing info into?