12 #include <workflow/WFHttpServer.h>
16 std::ifstream fp(
"./index.html");
17 std::string __htmlIndexBody((std::istreambuf_iterator<char>(fp)),
18 std::istreambuf_iterator<char>());
20 fmt::print(fg(fmt::color::floral_white) | bg(fmt::color::slate_gray) | fmt::emphasis::underline,
22 fmt::print(fg(fmt::color::steel_blue) | fmt::emphasis::italic,
"{}\n",
m_sysInfo.
m_osInfo);
23 fmt::print(
"[ info ] Get the ./index.html file. Start HTTP server at {}{}\n",
25 fmt::print(
"[ info ] Press ^C to stop server.\n");
27 WFHttpServer server([=](WFHttpTask* task) {
28 protocol::HttpResponse* resp = task->get_resp();
29 resp->add_header_pair(
"Content-Type",
"text/html; charset=utf-8");
30 resp->set_http_version(
"HTTP/1.1");
31 resp->set_status_code(
"200");
32 resp->set_reason_phrase(
"OK");
33 resp->append_output_body(__htmlIndexBody.c_str());