|
|
@ -19,9 +19,11 @@ limitations under the License.
|
|
|
|
#include <nlohmann/json.hpp>
|
|
|
|
#include <nlohmann/json.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
#include "AppLauncher.h"
|
|
|
|
#include "AppLauncher.h"
|
|
|
|
|
|
|
|
#include "Settings.h"
|
|
|
|
|
|
|
|
|
|
|
|
HttpServer::HttpServer(AppLauncher& app_launcher) : app_launcher_(app_launcher)
|
|
|
|
HttpServer::HttpServer(AppLauncher& app_launcher) : app_launcher_(app_launcher)
|
|
|
|
{}
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void HttpServer::run()
|
|
|
|
void HttpServer::run()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -30,6 +32,10 @@ void HttpServer::run()
|
|
|
|
res.set_content(j.dump(), "text/json");
|
|
|
|
res.set_content(j.dump(), "text/json");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
server_.Get("/settings", [this](const httplib::Request& req, httplib::Response& res) {
|
|
|
|
|
|
|
|
res.set_content(Settings::toJson().dump(), "text/json");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
server_thread_ = std::thread([this]() {
|
|
|
|
server_thread_ = std::thread([this]() {
|
|
|
|
if (!server_.listen("0.0.0.0", port_)) {
|
|
|
|
if (!server_.listen("0.0.0.0", port_)) {
|
|
|
|
spdlog::error("Couldn't start http-server");
|
|
|
|
spdlog::error("Couldn't start http-server");
|
|
|
|