A simple wrapper to the C++ REST SDK from Microsoft https://github.com/Microsoft/cpprestsdk.
First, make sure you have CMake (version >= 3.2), a recent C++ compiler and all the dependencies installed:
Very likely you can find packaged versions in your system's package repository. Make sure you are installing the development version of the packages, which also include header files.
Note that gmock is also needed to compile the unit tests but, if everything goes right, it will be downloaded automatically by CMake (needless to say: you do need a working Internet connection for this step).
git clone git@github.com:ccicconetti/rest.git
cd rest
git submodule update --init --recursive
Once everything is ready (assuming clang++
is your compiler):
cd build/debug
../build.sh clang++
make
This will compile the full build tree consisting of:
Rest
: library with simple wrappers of cpprestTest
: unit tests, which you can execute withTest/testrest
If you want to compile with compiler optimisations and no assertions:
cd build/release
../build.sh clang++
make
The unit tests will not be compiled (gmock will not be even downloaded).
At least two ways:
-
[recommended] Include the full git source tree in your project as a submodule (e.g., under
rest
), addadd_subdirectory(rest/Rest)
andadd_subdirectory(rest/support/Support)
directives to yourCMakeLists.txt
file, fix the header inclusion path so that is also searches in there, and finally in all your targets that use the library adduiiitrest
anduiiitsupport
. -
Copy the header files in your header inclusion path, copy the compiled libraries in your library inclusion path. This applies to both uiiitrest and uiiitsupport (included as a sub-module).
Method 1 is preferrable because: the dependency stays together with your code; if improvements/fixes are made to the library you just have to update the submodule.
Client
: wrapper ofweb::http::client::http_client
Server
: wrapper ofweb::http::experimental::listener::http_listener
DataType
: wrapper ofweb::json::value
ProblemDetails
: Problem Details object, as defined in IETF RFC 7807