https://github.com/oatpp/example-consul
Example project how-to use oatpp-consul integration module.
https://github.com/oatpp/example-consul
consul cpp integration oatpp
Last synced: 8 months ago
JSON representation
Example project how-to use oatpp-consul integration module.
- Host: GitHub
- URL: https://github.com/oatpp/example-consul
- Owner: oatpp
- License: apache-2.0
- Created: 2019-01-30T00:04:44.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-04-22T21:25:56.000Z (over 1 year ago)
- Last Synced: 2024-10-29T22:51:42.464Z (about 1 year ago)
- Topics: consul, cpp, integration, oatpp
- Language: C++
- Homepage: https://oatpp.io/
- Size: 22.5 KB
- Stars: 3
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Consul Integration Example [](https://dev.azure.com/lganzzzo/lganzzzo/_build?definitionId=15&branchName=master)
Example project how-to use [oatpp-consul](https://github.com/oatpp/oatpp-consul) module.
See more:
- [Oat++ Website](https://oatpp.io/)
- [Oat++ Github Repository](https://github.com/oatpp/oatpp)
- [Get Started](https://oatpp.io/docs/start)
## Overview
This project is using [oatpp](https://github.com/oatpp/oatpp) and [oatpp-consul](https://github.com/oatpp/oatpp-consul) modules.
Currently this is trivial example.- Read/Write from/to Consul KV via endpoints declared in Controller.
More complex example later.
In this example Consul is expected to run at port 8500.
### Project layout
```
|- CMakeLists.txt // projects CMakeLists.txt
|- src/
| |
| |- controller/ // Folder containing controller where all endpoints are declared
| |- dto/ // DTOs are declared here
| |- AppComponent.hpp // Service config
| |- App.cpp // main() is here
|
|- test/ // test folder
|- utility/install-oatpp-modules.sh // utility script to install required oatpp-modules.
```
---
### Build and Run
#### Using CMake
**Requires**
- `oatpp` and `oatpp-consul` modules installed. You may run `utility/install-oatpp-modules.sh`
script to install required oatpp modules.
```
$ mkdir build && cd build
$ cmake ..
$ make
$ ./example-consul-exe # - run application.
```
#### In Docker
```
$ docker build -t example-consul .
$ docker run -p 8000:8000 -t example-consul
```