Skip to content

imesper/cpp-minimal-rest-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimal Microservice Rest API

A minimal microservice rest api with only two get (/authenticate and /posts) methods using cpprestsdk https://github.com/Microsoft/cpprestsdk

Getting Started

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.

Installing

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

Running the tests

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

Running the server

$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

Test with postman

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.

Built With

Authors

License

This project is licensed under the GPL License

About

Minimal rest api in C++ using CPPRESTSDK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors