{"id":5163,"date":"2026-04-07T13:05:37","date_gmt":"2026-04-07T04:05:37","guid":{"rendered":"https:\/\/www.freelifemakers.org\/wordpress\/?p=5163"},"modified":"2026-04-07T13:05:37","modified_gmt":"2026-04-07T04:05:37","slug":"webserverhttplib-webservermacos","status":"publish","type":"post","link":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/2026\/04\/07\/webserverhttplib-webservermacos\/","title":{"rendered":"[Webserver]httplib webserver(MacOS)"},"content":{"rendered":"\n<p>\ud83d\udc49\ud83c\udffb C++\uc758 httplib\ub97c \uc0ac\uc6a9\ud55c \ub9e4\uc6b0 \uac04\ub2e8\ud55c \uc6f9\uc11c\ubc84 \uc785\ub2c8\ub2e4.<br>This is a very simple web server using C++&#8217;s httplib.<\/p>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb \uc0ac\uc6a9\ubc29\ubc95\uc740 nodejs express\uc11c\ubc84\uc640 \ub9e4\uc6b0 \uc720\uc0ac\ud569\ub2c8\ub2e4.<br>The usage is very similar to the Node.js Express server.<\/p>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb\ucf54\ub4dc \/ Code<\/p>\n\n\n\n<p>\u2714\ufe0f httplib.h<\/p>\n\n\n\n<p>&#8212; \uc544\ub798\uc758 \uba85\ub839\uc5b4\ub85c \ub2e4\uc6b4\ub85c\ub4dc\ud569\ub2c8\ub2e4.<br>Download using the command below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -L https:\/\/raw.githubusercontent.com\/yhirose\/cpp-httplib\/master\/httplib.h -o httplib.h<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f httplib_server.cpp<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include \"httplib.h\"\n#include &lt;iostream&gt;\n\nint main()\n{\n  httplib::Server svr;\n\n  svr.Get(\"\/\",&#91;](const httplib::Request &amp;req, httplib::Response &amp;res){\n   res.set_content(\"Hello from cpp-httplib!\",\"text\/plain\");\n  });\n\n  svr.Get(\"\/hi\", &#91;](const httplib::Request &amp;req, httplib::Response &amp;res) {\n    res.set_content(\"Hi! from cpp-httplib!\", \"text\/plain\");\n  });\n\n  std::cout &lt;&lt; \"cpp-httplib server listening on http:\/\/localhost:8080\" &lt;&lt; std::endl;\n  svr.listen(\"0.0.0.0\", 8080);\n\n  return 0;\n}\n<\/code><\/pre>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb \ucef4\ud30c\uc77c \/ Compiling<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>g++ -o httplib_server httplib_server.cpp -std=c++11 -pthread<\/code><\/pre>\n\n\n\n<p>\ud83d\udc49\ud83c\udffb\uc2e4\ud589 \/ run<\/p>\n\n\n\n<p>\u2714\ufe0f \uc11c\ubc84 \uc2e4\ud589 \/ Run server<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/httplib_server<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f \ube0c\ub77c\uc6b0\uc800\uc5d0\uc11c \uc11c\ubc84 \uc811\uc18d \/ Connect to server from browser<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"910\" height=\"434\" data-id=\"5165\" src=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/04\/hello.png\" alt=\"\" class=\"wp-image-5165\" srcset=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/04\/hello.png 910w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/04\/hello-300x143.png 300w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/04\/hello-768x366.png 768w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/04\/hello-400x191.png 400w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/04\/hello-800x382.png 800w\" sizes=\"auto, (max-width: 910px) 100vw, 910px\" \/><figcaption class=\"wp-element-caption\">\/<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"682\" height=\"444\" data-id=\"5164\" src=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/04\/hi.png\" alt=\"\" class=\"wp-image-5164\" srcset=\"https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/04\/hi.png 682w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/04\/hi-300x195.png 300w, https:\/\/www.freelifemakers.org\/wordpress\/wp-content\/uploads\/2026\/04\/hi-400x260.png 400w\" sizes=\"auto, (max-width: 682px) 100vw, 682px\" \/><figcaption class=\"wp-element-caption\">\/hi<\/figcaption><\/figure>\n<\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\udc49\ud83c\udffb C++\uc758 httplib\ub97c \uc0ac\uc6a9\ud55c \ub9e4\uc6b0 \uac04\ub2e8\ud55c \uc6f9\uc11c\ubc84 \uc785\ub2c8\ub2e4.This is a very simple web server using C++&#8217;s httplib. \ud83d\udc49\ud83c\udffb \uc0ac\uc6a9\ubc29\ubc95\uc740 nodejs express\uc11c\ubc84\uc640 \ub9e4\uc6b0 \uc720\uc0ac\ud569\ub2c8\ub2e4.The usage is very similar to the Node.js Express server. \ud83d\udc49\ud83c\udffb\ucf54\ub4dc \/ Code \u2714\ufe0f httplib.h &#8212; \uc544\ub798\uc758 \uba85\ub839\uc5b4\ub85c \ub2e4\uc6b4\ub85c\ub4dc\ud569\ub2c8\ub2e4.Download using the command below. \u2714\ufe0f httplib_server.cpp \ud83d\udc49\ud83c\udffb \ucef4\ud30c\uc77c \/ Compiling \ud83d\udc49\ud83c\udffb\uc2e4\ud589 \/ run \u2714\ufe0f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,1],"tags":[],"class_list":["post-5163","post","type-post","status-publish","format-standard","hentry","category-cpp","category-uncategorized","missing-thumbnail"],"_links":{"self":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/5163","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=5163"}],"version-history":[{"count":1,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/5163\/revisions"}],"predecessor-version":[{"id":5166,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/5163\/revisions\/5166"}],"wp:attachment":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=5163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=5163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=5163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}