News for hackers. Stuff that matters.

Ask HN: C/C++ web framework with routes (like Node.js, Python Flask)

Node.js, and Python Flask or Bottle micro-frameworks make it possible to create a server with routes like this:

    from bottle import route, run
    @route('/hello')
    def index():
        return 'hello world'
    @route('/news')
    def news():
        ...
    run(port=8080)
What are the most popular solutions like this in C or C++?
( 13 comments | 19 points | on HN )
Re:Ask HN: C/C++ web framework with routes (like Node.js, Py... by cozzyd on Wednesday May 18, 2022 @03:16PM (#31426542)
I've used CrowCpp and httplib. httplib has more flexible routing (using regex), though CrowCpp is overall nicer to use.

edit: here's a link to httplib: https://github.com/yhirose/cpp-httplib (CrowCpp has already been linked by someone else)

Re:Ask HN: C/C++ web framework with routes (like Node.js, Py... by _448 on Wednesday May 18, 2022 @03:58PM (#31426946)
Why not use Wt(Https://www.webtoolkit.eu)? It has all the bells and whistles included. Here is the examples page showing what it is capable of: https://www.webtoolkit.eu/widgets

The other option is uWs(https://github.com/uNetworking/uWebSockets) but then you have to include the missing parts such as templating system and ORM.

Re:Ask HN: C/C++ web framework with routes (like Node.js, Py... by tuna_hn on Friday May 20, 2022 @06:55AM (#31445671)
I have used Drogon. It's a very performant one. https://github.com/drogonframework/drogon
Re:Ask HN: C/C++ web framework with routes (like Node.js, Py... by melenaboija on Wednesday May 18, 2022 @02:48PM (#31426261)
I have been using Crow C++. I find it easy to use and pretty straightforward.

https://github.com/ipkn/crow

Re:Ask HN: C/C++ web framework with routes (like Node.js, Py... by data-cat on Wednesday May 18, 2022 @04:18PM (#31427135)
I really liked Crow but unfortunately it seems like the project has been abandoned.
Re:Ask HN: C/C++ web framework with routes (like Node.js, Py... by Kranar on Wednesday May 18, 2022 @07:39PM (#31428940)
If we're talking about this:

https://crowcpp.org

Then the project is pretty active, has multiple commits per week based on its log.

Re:Ask HN: C/C++ web framework with routes (like Node.js, Py... by melenaboija on Wednesday May 18, 2022 @05:35PM (#31427979)
As of today has been doing all what I needed and I found no bugs for my use
Re:Ask HN: C/C++ web framework with routes (like Node.js, Py... by cozzyd on Thursday May 19, 2022 @07:02PM (#31441299)
It's been picked up by other maintainers
Re:Ask HN: C/C++ web framework with routes (like Node.js, Py... by adarsh_p on Wednesday May 18, 2022 @04:26PM (#31427214)
We've used this and like it so far: https://github.com/meltwater/served
Re:Ask HN: C/C++ web framework with routes (like Node.js, Py... by tomcam on Thursday May 19, 2022 @02:53AM (#31431501)
Re:Ask HN: C/C++ web framework with routes (like Node.js, Py... by _benj on Wednesday May 18, 2022 @08:49AM (#31422086)
I once used facil.io and quite enjoyed it!
Re:Ask HN: C/C++ web framework with routes (like Node.js, Py... by josephernest on Wednesday May 18, 2022 @08:53AM (#31422128)
thanks!

i just looked, it doesn't seem to have this easy "route('/hello/world')" system, at least not in the main examples, is it included?

Re:Ask HN: C/C++ web framework with routes (like Node.js, Py... by p0d on Wednesday May 18, 2022 @03:59PM (#31426953)
Think you are looking for Blazor :-)