// // main.cc // // Copyright (c) 2024 Yuji Hirose. All rights reserved. // MIT License // #include #include #include using namespace httplib; using namespace std; auto error_html = R"( %d %s

404 Not Found


cpp-httplib/%s
)"; int main(int argc, const char **argv) { Server svr; svr.set_error_handler([](const Request & /*req*/, Response &res) { char buf[BUFSIZ]; snprintf(buf, sizeof(buf), error_html, res.status, status_message(res.status), CPPHTTPLIB_VERSION); res.set_content(buf, "text/html"); }); svr.set_mount_point("/", "./html"); svr.listen("0.0.0.0", 80); return 0; }