I’ve been exploring a similar approach using angular on the front end and a c++11 fastcgi backend. The community for this type of stuff is abysmally tiny (for good reason because it’s most certainly the wrong tool for the job) but it’s been a mostly fun little hobby project.
I’ve been looking for something like slowcgi. If there’s one thing I miss about CGI (and developing in PHP), it’s being able to write little scripts that just sit there on disk when not in use. Sure, it’s not great for “proper” websites, but for little toys/experiments I’d like to leave up indefinitely, nowadays I’d usually have to keep multiple daemons running since nginx et al. only support FastCGI or HTTP proxying. Dropping a script into a directory vs. configuring process supervision and always-on programs that sit idle 99% of the time.
Can you have a FastCGI backend that is launched on-demand?
From brief Googling, it sounds like Apache and lighttpd can both launch FastCGI backends for you on-demand, but nginx’s doesn’t. It’s much less convenient than just dropping files in a directory, but some nice person called mtjm wrote a blog post about using systemd socket activation for FastCGI.
Edit: of course, fork() + exec()ing a program written in C takes a large fraction of a millisecond these days, so it’s not so bothersome if your application is doing any interesting amount of work for each call.
At least use C++ as it has RAII and std::string etc. which are basically made for avoiding memory leaks/use after free.
Why don’t people use SCGI? Its spec is like one page compared to twenty for FastCGI.
And FastCGI is pretty daft in some ways - no flow control, complicated binary format, whereas ‘SCGI has the same property of “transmitter of HTTP data that isn’t HTTP” but is not insanely overcomplex and full of mistakes’. I think FastCGI became as popular as it is mostly due to the timing of nginx supporting it at a time when hosting PHP on Apache was getting pretty painful. nginx has an scgi module but PHP didn’t support it, and PHP is kind of a steamroller in terms of sheer numbers.
(edited to actually make sense ;-))