layout source from main

This commit is contained in:
2026-06-13 10:49:41 +07:00
parent 8c111f2406
commit 853acefac1
25 changed files with 1848 additions and 1463 deletions

View File

@@ -0,0 +1,40 @@
#include "app/lidar_manager_app.hpp"
#include "server/api_server.hpp"
#include "server/static_file_server.hpp"
#include "storage/state_repository.hpp"
#include <httplib.h>
#include <cstdio>
namespace lm {
LidarManagerApp::LidarManagerApp(int port,
std::filesystem::path www_root,
std::filesystem::path data_path)
: port_(port), www_root_(std::move(www_root)), data_path_(std::move(data_path))
{
}
int LidarManagerApp::run()
{
StateRepository repo(data_path_);
repo.load();
httplib::Server svr;
ApiServer api(repo);
api.registerRoutes(svr);
StaticFileServer::mount(svr, www_root_);
std::fprintf(stderr,
"lidar_manager_web listening on http://0.0.0.0:%d (www=%s, state=%s, models=%s)\n",
port_,
www_root_.string().c_str(),
data_path_.string().c_str(),
(data_path_.parent_path() / "models").string().c_str());
svr.listen("0.0.0.0", port_);
return 0;
}
} // namespace lm