Better HN
topnewbestaskshowjobs
Log inSign up

an-tao

116 karma · joined Mar 19, 2019 (7y ago) · 12 submissions

Submissions

1.

Show HN: A modern C++ web application framework(github.com ↗)

2 points · by an-tao · 5y ago · discuss

comment 7y ago · link · parent

https://github.com/an-tao/drogon

3.

Show HN: Drogon becomes one of the fastest web frameworks(techempower.com ↗)

2 points · by an-tao · 7y ago · 1 comment

comment 7y ago · link · parent

About 5M bytes in size, considering that the drogon application is statically linked, I am afraid it has no advantage in binary size.

comment 7y ago · link · parent

It's an embarrassing mistake, thank you for your reminder, but it seems that it's too late to change the name.

comment 7y ago · link · parent

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.

comment 7y ago · link · parent

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...

comment 7y ago · link · parent

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.

comment 7y ago · link · parent

Maybe I misused the proper nouns, what I mean is 'non-blocking I/O'. Thanks for your reminder.

comment 7y ago · link · parent

Your suggestion is very good, I have made some modifications.

comment 7y ago · link · parent

It has recently been submitted to TFB.

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

12.

Show HN: Drogon – A C++14/17 based high performance HTTP application framework(github.com ↗)

189 points · by an-tao · 7y ago · 105 comments