Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    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.
    Aayush-2492
    @Aayush-2492

    Whats the error in this line used inside controller:
    SessionPtr s = std::make_shared<Session>(req->session());

    Anyone?

    An Tao
    @an-tao

    Hi! How do I disable hiredis? I want to use drogon without any data base, just for REST client/server for data exchange.

    cmake .. -DBUILD_REDIS=off

    Whats the error in this line used inside controller:
    SessionPtr s = std::make_shared<Session>(req->session());

    just use auto s = req->session();

    Francisco
    @frares_gitlab
    Thanks!
    Osvaldo-Gutierrez
    @Osvaldo-Gutierrez
    image.png
    Hi, i'm trying to make a REST service (GET) and I need close the connection after send response, so I read that have to set param setCloseConnection(true), but doesn't work. Do this param works within GET?
    An Tao
    @an-tao
    it depends on behaviors of the client, the method just add a head of connection: close
    Aayush-2492
    @Aayush-2492
    I am sorry this might not be the right place to ask this question but does anyone know how to link a .a file with cpp code like g++ ....... .
    An Tao
    @an-tao
    -l
    or just list it with the source code
    Aayush-2492
    @Aayush-2492
    std::string name = "Name Surname";'
    req->session()->insert("name", name);
    This part of code gives segmentation fault
    Martin Chang
    @marty1885
    app().enableSession(true);
    For performance reasons, session is disabled by default.
    Aayush-2492
    @Aayush-2492
    Oh thanks
    Missed it in the docs
    Aayush-2492
    @Aayush-2492
    The session object is a singleton right? I mean if I insert() data into session object in one controller and get() it on another controller, i will get the same data right?
    An Tao
    @an-tao

    The session object is a singleton right? I mean if I insert() data into session object in one controller and get() it on another controller, i will get the same data right?

    Yes

    Aayush-2492
    @Aayush-2492
    I have these two controllers(login and announcements). The login controller calls the homepage.csp view and the view calls the announcement controller
    But the string inserted under name key of session in login is not returned in announcements
    The sessionId is also same. I checked
    Screenshot 2021-07-22 at 11.54.53 AM.png
    Screenshot 2021-07-22 at 11.55.28 AM.png
    An Tao
    @an-tao
    Please check the cookies of requests and responses in dev tools of the browser.
    Martin Chang
    @marty1885
    @Aayush-2492 My bad. Not app().enableSession(true);. But app().enableSession(std::chrono::seconds(3600));
    The parameter is how long the session is stored.
    Aayush-2492
    @Aayush-2492
    Ya thanks.
    But the docs mention default is 1200sec
    Martin Chang
    @marty1885
    @an-tao I think that's a doc error?
    An Tao
    @an-tao
    I think the default value is 1200 second.
    Martin Chang
    @marty1885
    You can't. C++ doesn't include source information in exceptions. (Not without extra setup and external tools)
    Try debug with cout/cerr/LOG_*
    Aayush-2492
    @Aayush-2492
    Is there any way to access the HttpViewData variable inside the script tag?
    [[ nameofVar ]] doesnt seem to work inside script tag
    Martin Chang
    @marty1885
    It does
    image.png
    image.png
    Aayush-2492
    @Aayush-2492
    When i tried to do const var = [[ nameofVar ]]; It gave this error
    Uncaught SyntaxError: Unexpected token ';'
    Martin Chang
    @marty1885
    Because var is a keyword in JS
    And CSPs is a template system. It don't automatically quote variables for you.
    Aayush-2492
    @Aayush-2492
    nope wait. I typed const name = [[ nameofVar ]]; not var