Recent submissions

Comment · 7 years ago
Comment · 7 years ago
About 5M bytes in size, considering that the drogon application is statically linked, I am afraid it has no advantage in binary size.
Comment · 7 years ago
It's an embarrassing mistake, thank you for your reminder, but it seems that it's too late to change the name.
Comment · 7 years ago
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 · 7 years ago
Comment · 7 years ago
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 · 7 years ago
Maybe I misused the proper nouns, what I mean is 'non-blocking I/O'. Thanks for your reminder.
Comment · 7 years ago
Your suggestion is very good, I have made some modifications.
Comment · 7 years ago

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton