完善了部分逻辑,优化网页

This commit is contained in:
zjk
2025-02-27 20:27:33 +08:00
parent 02d54a585a
commit 9cc3140651
9 changed files with 205 additions and 48 deletions
+9 -5
View File
@@ -24,7 +24,7 @@ int main() {
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;
// 定义路由,处理根路径的请求
@@ -100,8 +100,6 @@ int main() {
return response;
});
// 定义路由,处理 /api/moos-notify 的请求(POST)
CROW_ROUTE(app, "/api/moos-notify").methods("POST"_method)
([&moosClient](const crow::request& req) {
@@ -137,8 +135,14 @@ int main() {
return res;
});
// 启动服务器,监听端口 18080
app.port(18080).multithreaded().run();
// 启动服务器,监听端口 18080 并启动多线程
std::cout << "Server started on port 18080" << std::endl;
// app.port(18080).multithreaded().run();
app.port(18080)
.multithreaded()
.concurrency(16) // 增加并发线程数
.run();
return 0;
}