ADD_METHOD_TO(Ctrl::handleSome, "/path/to/handler", "filter1","filter2","filter3");
It is possible with METHOD_ADD to chain filters?
@thylacinelol
if you configure document_root directory and add *.html files, public can access it,
even if it's located on document_root
/docs/how-to-x.html
this is also equilevant as domain.tld[:port-if-any]/docs/how-to-y.html
open this https://drogon.org/images/drogon-concise-white.png and look https://github.com/drogonframework/drogon-website/tree/master/content/images
@thylacinelol
something like this doable with c++20
Home.h
namespace MyProject
{
namespace controllers
{
class Home
: public drogon::HttpController<Home>
{
public:
METHOD_LIST_BEGIN
ADD_METHOD_TO(Home::HomePage, "/", drogon::Get);
ADD_METHOD_TO(Home::HelloPage, "/hello", drogon::Get);
METHOD_LIST_END
void HomePage(const drogon::HttpRequestPtr &req,
std::function<void(const drogon::HttpResponsePtr&)>&&callback);
drogon::AsyncTask HelloPage(const drogon::HttpRequestPtr req,
std::function<void(const drogon::HttpResponsePtr&)>callback);
}; // class Home
} // namespace controllers
} // namespace MyProject
Home.cc
#include "Home.h"
using namespace backendV1::controllers;
void Home::HomePage(const drogon::HttpRequestPtr &req,
std::function<void(const drogon::HttpResponsePtr&)>&&callback)
{
// ... some logic
}
drogon::AsyncTask Home::HelloPage(const drogon::HttpRequestPtr req,
std::function<void(const drogon::HttpResponsePtr&)>callback)
{
auto client = drogon::HttpClient::newHttpClient("http://www.localhost.com:8001");
auto request = drogon::HttpRequest::newHttpRequest();
request->setMethod(drogon::Get);
request->setPath("/hello.html");
auto foo = co_await client->sendRequestCoro(request);
auto bar = foo->getBody();
std::string baz{bar};
resp = drogon::HttpResponse::newHttpResponse();
resp->setBody(baz);
callback(resp);
}
hi @an-tao, we have an issue related to LOG_DEBUG macro. When we integrate our system with an external logging system which uses syslog, as syslog has same macro it is overriding. Is it possbile to use some prefix before those macros. LOG_DEBUG, LOG_ERROR etc is very common and mostly logging libraries uses them.
The solution I can think of is to compile your app with dragon source code, then resolve the conflict by string replacing
Hi everyone,
what is the equivalent of:
auto cmd = R"(
update public.account_verification_email set token_expired=true where email=$1;
)";
db->execSqlAsyncFuture(cmd, u_email);
in drogon::orm ?
<br>
I tried:
orm::Mapper<AccountVerificationEmail> aveMP(db);
aveMP.updateFutureBy(
AccountVerificationEmail::Cols::_token_expired,
orm::Criteria(AccountVerificationEmail::Cols::_email,
orm::CompareOperator::Like, u_email),
true);
but gets error:
[build] /home/prg/backend/beCPP/db/postgresdb.h:326:53: note: cannot convert ‘drogon_model::database_name::AccountVerificationEmail::Cols::_token_expired’ (type ‘const string’ {aka ‘const std::__cxx11::basic_string<char>’}) to type ‘const std::vector<std::__cxx11::basic_string<char> >&’
[build] 326 | AccountVerificationEmail::Cols::_token_expired,
[build] | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
these column was actually boolean.
Can someone correct me which part should be change?
Raw sql command is fine, but I want to maximize using drogon orm.
newFileUploadRequest
? — https://drogon.docsforge.com/master/api/drogon/HttpRequest/newFileUploadRequest/