Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    An Tao
    @an-tao
    This kind of callback nesting can be perfectly solved by coroutine
    Alababdiy
    @Alababdiy
    how to get drogon:orm:Row columns ?
    An Tao
    @an-tao
    use index or iterator
    or name
    Alababdiy
    @Alababdiy
    inline json row_to_json(const Row &row){
    json r ;
        for (short i = 0; i< row.size();i++)
        {
            cout << "Key" << row.operator[](i).as<string>();
            cout << "Value" << row.operator[](i).as<string>();
            r.emplace(row.operator[](i).as<string>(),row.operator[](i).as<string>());
        }
        return r;
    }

    use index or iterator

    i can't detect columns name

    An Tao
    @an-tao
    why not use row[i]?
    you could use row[i].name() to get the column name
    Alababdiy
    @Alababdiy

    thanks An Tao

    why not use row[i]?

    Aayush-2492
    @Aayush-2492
    Something strange is happening. If I register a controller from main.cc it works fine but if a define a controller in the controller folder and go to that path it says 404 not found.
    An Tao
    @an-tao
    did you re-configure your project with cmake after adding the controller?
    Aayush-2492
    @Aayush-2492
    Do i need to? I created the controller by drogon_ctl command.
    An Tao
    @an-tao
    yes, you need. drogon_ctl just create the files.
    Aayush-2492
    @Aayush-2492
    Oh
    What line do I need to add to the CMake file then?
    An Tao
    @an-tao
    You don't need add new lines, just run cmake ..
    Aayush-2492
    @Aayush-2492
    OK that but I did run cmake .. and make in the terminal
    An Tao
    @an-tao
    does it work?
    Aayush-2492
    @Aayush-2492
    No.
    I meant before I asked the question, I had run CMake.
    An Tao
    @an-tao
    after you added new controllers?
    please paste your routing macros here
    Aayush-2492
    @Aayush-2492

    METHOD_LIST_BEGIN

    METHOD_ADD(login::loginHandler, "/login", Post);
    METHOD_ADD(login::loginCheckHandler, "/logincheck", Post);

    METHOD_LIST_END

    Screenshot 2021-07-18 at 7.15.08 PM.png
    Image also if it helps ^
    An Tao
    @an-tao
    did you add the spacename and class name to the path when accessing the web?
    or you should use the ADD_METHOD_TO macro to avoid that.
    Aayush-2492
    @Aayush-2492
    Thanks
    I will try it
    Is there an function that lets WS server send messages to all clients(like emit in JS)?
    Or I will have to store the WebSocketClientPtr for each object in a data structure
    An Tao
    @an-tao
    please refer to the PubSubService template, if you search it in the project, you'll find an example of chat room.
    Aayush-2492
    @Aayush-2492
    Thanks @an-tao
    praveenpillay
    @praveenpillay
    Thank you!
    Martin Chang
    @marty1885
    @0rangeFox I tried to get coroutines working on MSYS. But ended up either with libc++/stdc++ clash or MSYS not properly supporting clang.
    You'll have to wait for GCC 11 landing on MSYS, use visual studio or use Linux/WSL
    Aayush-2492
    @Aayush-2492
    How do I set the request parameter for chat room name for using PubSubService link
    An Tao
    @an-tao
    you could put it on URL, /path?chat_room=test
    Aayush-2492
    @Aayush-2492
    Whats the error in this line used inside controller:
    SessionPtr s = std::make_shared<Session>(req->session());
    João Fernandes
    @0rangeFox

    @0rangeFox I tried to get coroutines working on MSYS. But ended up either with libc++/stdc++ clash or MSYS not properly supporting clang.
    You'll have to wait for GCC 11 landing on MSYS, use visual studio or use Linux/WSL

    I do not know how to thank you for your loss of time, but thank you very much for your help, and I will look forward to it.

    João Fernandes
    @0rangeFox
    Someone can explain me a little about regex on endpoints? Because I'm trying to make start from one string, for example "data" with path and tell me doesn't exists that endpoint.
    Example: /v1/user/(?=data)
    Martin Chang
    @marty1885
    What kind of API are you trying to create?
    João Fernandes
    @0rangeFox
    RESTful API.
    Martin Chang
    @marty1885
    Try /v1/user?data={userdata}. Then make the handler void user(....., const std::string& userdata)
    João Fernandes
    @0rangeFox
    I know about that trick, but I wanted regex because I can have that query or no.
    Martin Chang
    @marty1885
    I'd recommend you register /v1/user and use req->getParameter("data") to get the user data
    It returns an empty string if non exists.
    João Fernandes
    @0rangeFox
    Oh! I believe I had some endpoint like that but never remembered that. Thanks!
    Francisco
    @frares_gitlab
    Hi! How do I disable hiredis? I want to use drogon without any data base, just for REST client/server for data exchange.
    Martin Chang
    @marty1885
    @frares_gitlab Your Drogon is compiled with Redis capability. You don't have to use it if you don't want to.
    Francisco
    @frares_gitlab
    Sure, but I would like to build it without having to have hiredis in my dependencies, in the same way we may disable Postgress bindings building, for an example.