优化了前端文件的机构

This commit is contained in:
zjk
2025-02-27 10:56:24 +08:00
parent 115ee57b14
commit 02d54a585a
4 changed files with 408 additions and 407 deletions
+7 -2
View File
@@ -19,18 +19,20 @@ using namespace std;
ccuState ccustate;
StateData stateData;
int main() {
crow::SimpleApp app;
SQLiteDB db("/home/zjk/project/H100/H100PowerManger/data/power_data.db");
MOOS::MOOSAsyncCommClient moosClient;
moosClient.Run("localhost", 9000, "appPowerMangerWebUI");
std::cout << " Current Path -> " << std::system("pwd") << std::endl;
// 定义路由,处理根路径的请求
CROW_ROUTE(app, "/")([]() {
auto page = crow::mustache::load_text("index.html");
return page;
});
// 定义路由,处理 /api/power-data 的请求
CROW_ROUTE(app, "/api/db-status")
([&db]() {
@@ -97,6 +99,9 @@ int main() {
}
return response;
});
// 定义路由,处理 /api/moos-notify 的请求(POST)
CROW_ROUTE(app, "/api/moos-notify").methods("POST"_method)
([&moosClient](const crow::request& req) {