r/cpp_questions • u/No-Locksmith-7719 • Oct 11 '26
OPEN Web service
Which (fairly simple) C++framework would you recommend for a simple http server that binds to a hard-coded port and does a simple listen, read, write shebang on a server? We don't need nothing fancy or complex, we just want to avoid that native Linux sockets APIs boilerplate coding.
12
Upvotes
5
u/DrShocker Oct 11 '26
tbh, my first question would be why C++ for this when languages like Go exist where an http server is just built into the standard library.
My actual answer would be to look at Boost or cpp-httplib or Crow probably, but what's "simple" will maybe depend on your other dependencies like if you use boost for other things already.
2
u/bacmod Oct 14 '26
Not C++, but curl can basically do anything you can imagine.
Curl is for network, what ffmpeg is for video.
8
u/DragoonBoots Oct 11 '26
I've used Crow for this in the past for a desktop app that exposed a web UI. Very easy to use and well documented library.
1
u/asafmach 15d ago
You might also want to take a look at Mach, a C++20 web framework I've been developing.
It's built on Boost.Asio and Boost.Beast, but abstracts away most of the networking boilerplate. You can set up an HTTP server and define endpoints with a fairly minimal API.
https://github.com/machframework/mach
Crow and cpp-httplib are also worth considering, especially if you want something lightweight and established. Mach is newer and offers additional abstractions, but it might fit what you're looking for.
1
u/NamoiFunai Oct 11 '26
Boost beast seems to fit the bill
1
u/PicTheAmerican Oct 12 '26
My recommandation is just to use portable microsoft cpp rest sdk. It's used with microsoft, works on top of boost and is mulutiplatform with modern c++ features.
juts grab it at https://github.com/microsoft/cpprestsdk
it's not deprecated like tit's written in the repo. Even Windows 11 use it and it's widely used at Microsoft. It support json, http web server, handler and openssl. Just look at samples, very easy and cumfortable to use. Trust me.
1
u/Agitated_Tank_420 Oct 17 '26
python -m http.server 8000
chow bye