A minimal microservice rest api with only two get (/authenticate and /posts) methods using cpprestsdk https://github.com/Microsoft/cpprestsdk
This project was developed and test on Linux. Windows and Apple may run the program, but might need some corrections. This project uses CMAKE to build and is dependent of CPPRESTSDK, which is dependable of Boost, SSL and Crypt. The tests are dependent of GTest https://github.com/google/googletest.
Make sure all libraries are installed and in PATH environment.
On shell:
$> cd minimal-rest-api $minimal-rest-api/> de debug (or release) $minimal-rest-api/debug/> cmake .. $minimal-rest-api/debug/> make $minimal-rest-api/debug/> make install
To run the tests $minimal-rest-api/debug/> make test
Or
$minimal-rest-api/debug/>cd ../bin/debug/ $minimal-rest-api/bin/debug/> ./run_rest_api_test
$minimal-rest-api/debug/>cd ../bin/debug/
$minimal-rest-api/bin/debug/> ./run_minial-rest-api
Usage: run_minimal-rest-api [OPTION...]
-h, --host arg Hostname (default: localhost) -p, --port arg port to listen on (default: 2000) --help Print help
Postman is a good app to test APIs, making it easy to set the basic authorization header to use the services http://localhost:2000/posts and http://localhost:2000/authenticate.
Authenticate just return 200 with basic auth header is set and 401 otherwise.
Posts returns the same JSON that it consumes from http://jsonplaceholder.typicode.com/posts. It also needs the authorization header.
- CPPRESTSDK - The C++ REST SDK from Microsoft
- Ian Esper - Initial work - Minimal-Rest-API
This project is licensed under the GPL License