优化了前端文件的机构
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user