aboutsummaryrefslogtreecommitdiff
path: root/api/umosapi.h
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-08-07 11:03:58 +0200
committerneodarz <neodarz@neodarz.net>2019-08-07 11:03:58 +0200
commit4c65baa7b6e0a85635f8028a5ff9979b870d7be0 (patch)
tree01a285bb270ada1363ca56c00538ef8b56c5e821 /api/umosapi.h
parent7dc4e5bfc85474700b3731fc06e48a0e5c1d387b (diff)
downloadumosapicpp-4c65baa7b6e0a85635f8028a5ff9979b870d7be0.tar.xz
umosapicpp-4c65baa7b6e0a85635f8028a5ff9979b870d7be0.zip
Refactoring umosapi service
Diffstat (limited to 'api/umosapi.h')
-rw-r--r--api/umosapi.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/api/umosapi.h b/api/umosapi.h
new file mode 100644
index 0000000..684f9d5
--- /dev/null
+++ b/api/umosapi.h
@@ -0,0 +1,33 @@
+#ifndef UmosapiService_H_
+#define UmosapiService_H_
+
+#include <pistache/http.h>
+#include <pistache/description.h>
+#include <pistache/endpoint.h>
+
+#include <pistache/serializer/rapidjson.h>
+
+using namespace Pistache;
+
+class UmosapiService {
+ public:
+
+ UmosapiService(Address addr);
+ virtual ~UmosapiService() {};
+
+ void init(size_t thr);
+
+ void start(std::string swaggerui);
+
+ private:
+ void createDescription();
+
+ void retrieveAll(const Rest::Request& request, Http::ResponseWriter response);
+
+ void addUObject(const Rest::Request& request, Http::ResponseWriter response);
+
+ std::shared_ptr<Http::Endpoint> httpEndpoint;
+ Rest::Description desc;
+ Rest::Router router;
+};
+#endif