Librestd: a library to create C++ RESTful API services

beefhash | 67 points

Quick feedback:

Use at least C++11 and the thread and mutex types in the standard library become available. Of if you must use C++03, use boost for these. There's not a good reason to reinvent those wheels.

Importing names (`using std::vector`, etc.) at the global scope in a header is not a great idea. You likely won't get burned by it as a library author, but the people wanting to use your library will, eventually.

I like the simplicity of approach for the http_request and http_response types. Many libraries try to provide type safety (i.e., a way to define a UserLoginRequest), but this is best left to a higher level library, in my opinion.

Don't name your enums WITH_ALL_CAPS. Those sorts of names often get smashed by the preprocessor. Given enough use, your library will eventually have a name collision there. I prefer using 'enum class' enums from C++11 and normal variable names. The enum class syntax forces the name to be scoped, so you don't have to worry about ambiguity or name collisions (provided you don't use YELLING_CASE_NAMES). If you must use all caps for some reason, prefix with your almost-certainly-unique namespace, so something like RESTD_HTTP_STATUS_OK.

humanrebar | 7 years ago

There is this very nice talk on building a C++ rest framework using functional programming concepts. I like the analytical approach to design, and really hope it becomes an open source library soon.

https://www.youtube.com/watch?v=nR2raX2-a0Q

arximboldi | 7 years ago

I'm not trying to sound like a dick here but:

Zero front page documentation. Zero open issues. What are we supposed to do with this link? Start sifting through source code?

katastic | 7 years ago

no tests. :(

je42 | 7 years ago