Reputation: 5175
I am planning to build a bunch of C++ based process to provide data as HTTP rest api on the front-end. I have been trying to decide if it is better to build in the HTTP server or to use FastCGI in the C++ processes. In either case the processes will be behind some webserver like nginx. To me it seems like FastCGI is simpler and would be easier to work with then having a fully HTTP server. FastCGI would also seem fast, not that it would matter much. I see testing would be easier if the C++ processes had HTTP built in just connect directly to it for internal use, but I have not found a simple C++ HTTP server library that I like yet. I am looking any other pro or cons.
Upvotes: 3
Views: 1513
Reputation: 5175
I found libevent has a simple http server built in. I have been using it and am very happy. I am using Qt and had to do a little work to put a wrapper around libevent in a thread, but it works great and is very simple.
Upvotes: 3
Reputation: 31
G-wan webserver, a 200 KB executable file, lets you write ANSI C scripts that are edited and executed on-the-fly (more convenient than fastCGI: all the HTTP work is done transparently).
You can also link any C/C++ library to G-WAN C scripts with "#pragma link".
Good luck with your project!
Upvotes: 1
Reputation: 1899
Don't even think of writing your own HTTP server unless you have a very clear and legitimate need to do so (which doesn't seem to be the case here). Go for FastCGI or even SCGI, which is a much simpler protocol to implement than FastCGI if you don't want to use a library or if you have specific needs for such an implementation.
Upvotes: 3