chore: init frontend+backend skeleton
这个提交包含在:
18
backend/src/health_controller.cc
普通文件
18
backend/src/health_controller.cc
普通文件
@@ -0,0 +1,18 @@
|
||||
#include "csp/health_controller.h"
|
||||
|
||||
#include "csp/version.h"
|
||||
|
||||
namespace csp {
|
||||
|
||||
void HealthController::health(
|
||||
const drogon::HttpRequestPtr& /*req*/,
|
||||
std::function<void(const drogon::HttpResponsePtr&)>&& callback) {
|
||||
auto json = Json::Value{};
|
||||
json["ok"] = true;
|
||||
json["version"] = kVersion;
|
||||
auto resp = drogon::HttpResponse::newHttpJsonResponse(json);
|
||||
resp->setStatusCode(drogon::k200OK);
|
||||
callback(resp);
|
||||
}
|
||||
|
||||
} // namespace csp
|
||||
15
backend/src/main.cc
普通文件
15
backend/src/main.cc
普通文件
@@ -0,0 +1,15 @@
|
||||
#include <drogon/drogon.h>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
// Basic defaults. Will be moved to config-driven later.
|
||||
drogon::app()
|
||||
.addListener("0.0.0.0", 8080)
|
||||
.setThreadNum(4);
|
||||
|
||||
LOG_INFO << "csp_server starting at http://0.0.0.0:8080";
|
||||
drogon::app().run();
|
||||
return 0;
|
||||
}
|
||||
5
backend/src/version.cc
普通文件
5
backend/src/version.cc
普通文件
@@ -0,0 +1,5 @@
|
||||
#include "csp/version.h"
|
||||
|
||||
namespace csp {
|
||||
// Keep translation unit for future expansion.
|
||||
} // namespace csp
|
||||
在新工单中引用
屏蔽一个用户