Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Alababdiy
    @Alababdiy
    image.png
    The messenger_receiver controller not registered on app when i request /view got 404 not found
    João Fernandes
    @0rangeFox
    Hey @Alababdiy, are you loading these controllers on CMakeLists?
    Aayush-2492
    @Aayush-2492
    does newHttpViewResponse() take only the name of .csp file or is .html also fine?
    An Tao
    @an-tao
    must be .csp, but it's content can be anything including HTML docs
    Martin Chang
    @marty1885
    There's also CSP syntax highlighting support for VSCode: https://marketplace.visualstudio.com/items?itemName=marty1885.drogon-csp-lanuage
    Aayush-2492
    @Aayush-2492
    Thanks for the extension. didn't know about it
    Rafael Bugajewski
    @rbugajewski
    yeah, thanks, I also didn’t know about it
    Rafael Bugajewski
    @rbugajewski
    @Aayush-2492 I’m throwing Ember.js into the mix :) https://emberjs.com/
    Aayush-2492
    @Aayush-2492
    @rbugajewski thanks but already started with vue :)
    Rafael Bugajewski
    @rbugajewski
    Good luck! Vue is probably the better choice in the generic case :)
    @0rangeFox What you talked about is a Smoke Test, but what @chungwong wants are Unit Tests. Both are tests, yes, but slightly different ones. They complement each other.
    1 reply
    Alababdiy
    @Alababdiy
    Hi .. i'm newbie
    after i add :-
    auto db2 = app().getFastDbClient();
    get this error
    Assertion failed: (iter != dbFastClientsMap_.end()), function getFastDbClient, file /Users/abdo/Workshop/vcpkg/buildtrees/drogon/src/v1.7.1-c852679de5.clean/lib/src/DbClientManager.h, line 42.
    config.json:-
    "db_clients": [
    {
    //name: Name of the client,'default' by default
    "name":"default",
    //rdbms: Server type, postgresql,mysql or sqlite3, "postgresql" by default
    "rdbms": "postgresql",
    //filename: Sqlite3 db file name
    //"filename":"",
    //host: Server address,localhost by default
    "host": "ec2-52-212-157-46.eu-west-1.compute.amazonaws.com",
    //port: Server port, 5432 by default
    "port": 5432,
    //dbname: Database name
    "dbname": "XXXXXX",
    //user: 'postgres' by default
    "user": "XXXXXX",
    //passwd: '' by default
    "passwd": "XXXXXX",
    //is_fast: false by default, if it is true, the client is faster but user can't call
    //any synchronous interface of it.
    "is_fast": true,
    //client_encoding: The character set used by the client. it is empty string by default which
    //means use the default character set.
    //"client_encoding": "",
    //number_of_connections: 1 by default, if the 'is_fast' is true, the number is the number of
    //connections per IO thread, otherwise it is the total number of all connections.
    "number_of_connections": 5,
    //timeout: -1.0 by default, in seconds, the timeout for executing a SQL query.
    //zero or negative value means no timeout.
    "timeout": 5
    }
    ....
    João Fernandes
    @0rangeFox
    Hey guys, could someone tell me if this is the only way to do it or is there a better way?
    image.png
    By the way, the variable "_dbClient" is of type: IOThreadStorage<DbClientPtr>
    João Fernandes
    @0rangeFox
    I think I was not very specific to my issue, what I really wanted to know, is regarding the variable "_dbClient", when passing in the "Captures" of the lambdas expressions.
    Rafael Bugajewski
    @rbugajewski
    It’s really hard to say something, because the context is missing.
    João Fernandes
    @0rangeFox
    Yes I get it but I personally also read that and got confused and I can't simplify it any more than that, what I basically meant, if you look there is a "capture" with the following parameter, "_dbClient = *_dbClient" in the last lambda, and I wonder if there is any way to just send "_dbClient" as the first lambda?
    praveenpillay
    @praveenpillay
    For a front end desktop application heavy on real time chart updates from drogon server, what would you guys recommend? Flutter, React Native, Vue or something else? Thank you!
    1 reply
    An Tao
    @an-tao

    Yes I get it but I personally also read that and got confused and I can't simplify it any more than that, what I basically meant, if you look there is a "capture" with the following parameter, "_dbClient = *_dbClient" in the last lambda, and I wonder if there is any way to just send "_dbClient" as the first lambda?

    Why not just capture this pointer instead of _dbClient

    João Fernandes
    @0rangeFox
    Because I need to fetch the object that is inside of the IOThreadStorage. Or am I forgetting something?
    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