I love to read stuff like this, "with a bit of effort I was able to build the whole back-end for my startup using C++", then I start to think: what would it take for me to migrate off Golang to C++?
I love to develop in Mac and deploy in Linux/Docker, so whatever stack I pick has to be compatible with both OS's, with this in mind I made a list of libraries I'd need to move my API to C++:
* Web Server library
* Web Framework-ish library
* JSON library for REST interface
* Database client library for my database
* Integration testing
After reading these useful blog posts I guess I'll pick:
* Web Server => Facebook's Proxygen
* Web Framework-ish library => Facebook's Wangle, but it doesn't seem to work in Mac, that's already a problem, I don't like having to have two dev environments.
* JSON library => looks like Facebook's Folly seems to have something for it, let's hope it uses modern c++ constructs and not some obscure templating magic to make it faster than other implementations.
* Database client library for RethinkDB: RethinkDB has no official driver and the only community driver public repository has only 22 starts and no CI setup on Github, I'm reluctant to trust this code, this is already a deal breaker to me.
* Integration testing => Wangle's documentation is scarce, there wiki is empty and the repo doesn't have a single code sample to take a look at. I can't go to production without testing, another deal breaker.
Yes, I agree, I don't have to pick RethinkDB. MySQL and PostgreSQL c++ drivers are very mature to use in production apps.
Of course they are, but:
* Do these drivers use modern C++ constructs?
* Would these drivers block proxygen/wangle IO loop(in case they have one?)
* Would I have to use callbacks to make achieve full IO speed? I hate callbacks, there is a reason I abandoned Node.js a long ago.
* How do I put all these dependencies together?
As with Golang, as much as I hate it's lack of generics and proper inheritance:
* Web server: Standard library `net/http`
* Web framework-ish: I don't really need a framework/pipeline for it, there are some neat web routers out there that just help me do the job.
* JSON library: Standard library `encoding/json`
* Database client library: gorethink and almost all the Golang database clients out there have significant adoption with over 700 stars on Github.
* Integration testing: Standard library `net/http/httptest`
Unlike D, C++ and Rust; the Golang ecosystem is unified, I know I'm able to pick a client library and it'd work with whatever stack I have in place because there's only one scheduler and therefore only one way to do IO, plus it's non-blocking without callbacks. I'm not a fan of vendoring dependencies, but it simply works.
In conclusion, I love C++ and even with all the significant progress made in C++11 and C++14, I'm still stucked with Go because it just works.