resp.body = w.write(resp_json); resp.set_header("Content-Type", "application/json"); }); http_svr.set_mount_point("/", "./web"); http_svr.listen("0.0.0.0", 21010); return 0; } 完整简单upload例子: #include "httplib.h" #include <iostream> #include <fstream> using namespace h...
svr.set_file_extension_and_mimetype_mapping("mp4","video/mpeg"); svr.set_file_extension_and_mimetype_mapping("avi","video/x-msvideo"); auto ret= svr.set_mount_point("/","./www");if(!ret) {//The specified base directory doesn't exist...std::cout <<"The specified base director...
resp.body = w.write(resp_json); resp.set_header("Content-Type", "application/json"); }); http_svr.set_mount_point("/", "./web"); http_svr.listen("0.0.0.0", 21010); return 0; } 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. ...
// Mount / to ./www directoryautoret = svr.set_mount_point("/","./www");if(!ret) {// The specified base directory doesn't exist...}// Mount /public to ./www directoryret = svr.set_mount_point("/public","./www");// Mount /public to ./www1 and ./www2 directoriesret =...
} // Mount /public to ./www directory ret = svr.set_mount_point("/public", "./www"); // Mount /public to ./www1 and ./www2 directories ret = svr.set_mount_point("/public", "./www1"); // 1st order to search ret = svr.set_mount_point("/public", "./www2"); // 2n...
remove_mount_point("/public");// User defined file extension and MIME type mappings svr.set_file_extension_and_mimetype_mapping("cc", "text/x-c"); svr.set_file_extension_and_mimetype_mapping("cpp", "text/x-c"); svr.set_file_extension_and_mimetype_mapping("hh", "text/x-h");...
directories ret = svr.set_mount_point("/public", "./www1"); // 1st order to search ret = svr.set_mount_point("/public", "./www2"); // 2nd order to search // Remove mount / ret = svr.remove_mount_point("/"); // Remove mount /public ret = svr.remove_mount_point("/...
directories ret = svr.set_mount_point("/public", "./www1"); // 1st order to search ret = svr.set_mount_point("/public", "./www2"); // 2nd order to search // Remove mount / ret = svr.remove_mount_point("/"); // Remove mount /public ret = svr.remove_mount_point("/...
静态文件在日常生活中很常用!本文尝试使用cpp-httplib来搭建一个静态文件 官方文档中关于静态的说明: // Mount / to ./www directory auto ret = svr.set_mount_point("/", "./www"); if (!ret) html ide 服务器 转载 已注销 2020-04-26 11:33:00 ...
ret = svr.remove_mount_point("/"); // Remove mount /public ret = svr.remove_mount_point("/public"); // User defined file extension and MIME type mappings svr.set_file_extension_and_mimetype_mapping("cc", "text/x-c"); svr.set_file_extension_and_mimetype_mapping("cpp", "text/x...