r/cpp_questions • • 4d ago

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.

10 Upvotes

5 comments sorted by

7

u/DragoonBoots 4d ago

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.

5

u/DrShocker 4d ago

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.

1

u/NamoiFunai 4d ago

Boost beast seems to fit the bill

1

u/PicTheAmerican 3d ago

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.

2

u/bacmod 1d ago

Not C++, but curl can basically do anything you can imagine.

Curl is for network, what ffmpeg is for video.