From bea27191c52d333a58b0981f6dfa5904df7638f3 Mon Sep 17 00:00:00 2001 From: Babicaa Date: Fri, 29 Mar 2019 16:18:01 +0100 Subject: [PATCH] Pass crow app to RestAPI In order to properly stop the REST api you need to have a handle to the app object. --- lib/src/RestApi.cpp | 4 +--- lib/src/RestApi.hpp | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/src/RestApi.cpp b/lib/src/RestApi.cpp index fc5c141..8c882d0 100644 --- a/lib/src/RestApi.cpp +++ b/lib/src/RestApi.cpp @@ -6,15 +6,13 @@ using namespace std; -void RestApi::start_rest_api(WriterManager& writer_manager, uint16_t port) +void RestApi::start_rest_api(crow::SimpleApp app, WriterManager& writer_manager, uint16_t port) { #ifdef DEBUG_OUTPUT cout << "[rest_interface::start_rest_api] Starting rest interface on port " << port << endl; #endif - crow::SimpleApp app; - CROW_ROUTE(app, "/kill")([&](){ writer_manager.kill(); diff --git a/lib/src/RestApi.hpp b/lib/src/RestApi.hpp index 01c0259..5029870 100644 --- a/lib/src/RestApi.hpp +++ b/lib/src/RestApi.hpp @@ -7,7 +7,7 @@ namespace RestApi { - void start_rest_api(WriterManager& writer_manager, uint16_t port); + void start_rest_api(crow::SimpleApp app, WriterManager& writer_manager, uint16_t port); } -#endif \ No newline at end of file +#endif