HNHacker News
TopNewBestAskShowJobs

an-tao

116 karma · joined March 19, 2019

submissionscomments
an-tao··on Show HN: Drogon becomes one of the fastest web frameworks
https://github.com/an-tao/drogon
an-tao··on Show HN: Drogon – A C++14/17 based high performance HTTP application framework
About 5M bytes in size, considering that the drogon application is statically linked, I am afraid it has no advantage in binary size.
an-tao··on Show HN: Drogon – A C++14/17 based high performance HTTP application framework
It's an embarrassing mistake, thank you for your reminder, but it seems that it's too late to change the name.
an-tao··on Show HN: Drogon – A C++14/17 based high performance HTTP application framework
You can register handler like this in Drogon:

   drogon::app.registerHttpMethod("/test",
                                   [=](const HttpRequestPtr& req,
                                       const std::function<void (const HttpResponsePtr &)> & callback)
                                   {
                                       Json::Value json;
                                       json["result"]="ok";
                                       auto resp=HttpResponse::newHttpJsonResponse(json);
                                       callback(resp);
                                   },
                                   {Get,"LoginFilter"});

The method in the readme file is for decoupling. Imagine a scene with dozens of path handlers. Isn't it better to disperse them in their respective classes?

Of course, for very simple logic, the interface you are talking about is really more intuitive, I will consider adding such an interface. Thank you for your comment.

an-tao··on Show HN: Drogon – A C++14/17 based high performance HTTP application framework
For benchmarking I have submitted it to the famous TFB and I am waiting for the result of testing round 18. https://github.com/TechEmpower/FrameworkBenchmarks/tree/mast...
an-tao··on Show HN: Drogon – A C++14/17 based high performance HTTP application framework
Good question! If the type of the parameter of callback is an r-reference, users must move resp into the callback. Note that the resp is a shared_ptr, which means callback can reuse the buffer or do anything to the resp object and copying smart pointers does not require too much cost.
an-tao··on Show HN: Drogon – A C++14/17 based high performance HTTP application framework
Maybe I misused the proper nouns, what I mean is 'non-blocking I/O'. Thanks for your reminder.
an-tao··on Show HN: Drogon – A C++14/17 based high performance HTTP application framework
Your suggestion is very good, I have made some modifications.
an-tao··on Show HN: Drogon – A C++14/17 based high performance HTTP application framework
It has recently been submitted to TFB.

https://github.com/TechEmpower/FrameworkBenchmarks/tree/mast...