/msabase-cpp

A base module for running a microservice for C++

Primary LanguageCMakeMIT LicenseMIT

License: MIT

C++ Microservice Template

This library is developed to allow for the rapid implementation of a microservice using the C++ REST SDK.

Getting Started

Prerequisites

This project has the following dependencies:

Dependencies can be installed on Ubuntu using the following command:

sudo apt install libboost-atomic-dev libboost-thread-dev libboost-system-dev libboost-date-time-dev libboost-regex-dev libboost-filesystem-dev libboost-random-dev libboost-chrono-dev libboost-serialization-dev libwebsocketpp-dev openssl libssl-dev libcpprest-dev -y

The following requires fewer compiler flags through the use of -DWERROR=OFF.

This project also supports building the dependencies Boost and C++ REST SDK from source by using cmake .. -DUSE_SYSTEM_BOOL=OFF -DUSE_SYSTEM_CPPRESTSDK=OFF. In this case the dependencies for Libwebsockets and OpenSSL will still need to exist on system.

Adding to your project

The reccommended way to add this library to you project is by including the following to your CMakeLists.txt:

cmake_minimum_required(VERSION 3.13)
project(myProject)

include_directories("path/to/msabase/include")
add_subdirectory("path/to/msabase")

add_executable(myProject myProject_SOURCES)
# or `add_library(myProject myProject_SOURCES)`

target_link_libraries(myProject msabase)

Usage

When using this library, create a child class of msabase::MainServiceController with your custom overrides of the available HTTP requests.

An example deployment using this library can be found in tests/src/testDeploy.cc

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Acknowledgements

This project is based largely on ivanmejiarocha/micro-service.