Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Daniel
    @Daniel-hnr
    @The-EDev which ide do you prefer?
    Farook Al-Sammarraie
    @The-EDev
    I generally use QTCreator
    with CMake for Crow projects
    Daniel
    @Daniel-hnr
    ok
    Farook Al-Sammarraie
    @The-EDev
    for simple projects I just build them using the terminal (g++ main.cpp -lpthread -o mycoolprogram)
    Daniel
    @Daniel-hnr
    thanks
    Farook Al-Sammarraie
    @The-EDev
    no problem
    Ring5S
    @Ring5S
    In the tutorial, I see that crow::SimpleApp has the run_async interface, but an error is reported during compilation. What is the cause?
    Farook Al-Sammarraie
    @The-EDev
    what is the error?
    Ring5S
    @Ring5S
    error: ‘using self_t = class crow::Crow<> {aka class crow::Crow<>}’ has no member named ‘run_async’
    .run_async();
    ^~~~~
    Farook Al-Sammarraie
    @The-EDev
    can you make sure the app and documentation are the same version? (v1.0.x documentation for v1.0.5 for example)
    Ring5S
    @Ring5S
    Oh, let me see.
    Thanks
    Farook Al-Sammarraie
    @The-EDev
    No problem
    Ring5S
    @Ring5S
    CROW_ROUTE(app,"/add/<int>/<int>") ([](const crow::request& /*req*/, crow::response& res, int a, int b){ std::ostringstream os; os << a+b; res.write(os.str()); res.end(); });
    For example, I want this interface to support 300 concurrent requests per second. How can I use Crow to support this requirement?
    Farook Al-Sammarraie
    @The-EDev
    I don't see why not..
    Farook Al-Sammarraie
    @The-EDev
    image.png
    So this happened
    Himanshu Rastogi
    @xhimanshuz
    @Ring5S What problem you are facing with current implementation?
    summer-espresso
    @summer-espresso
    @The-EDev Hello. Thank you for taking over the maintenance of crow. I made this https://github.com/summer-espresso/tm with crow. Crow is less versatile than uWebSocket but I appreciate it can compile in C++11 standard and it is easier than uWebSocket to install and use.
    Serenity
    @Daniele122898

    Hey im having problems utilizing the lib. I added it to my project by cloning it into an external/crow folder and then just linking it via Cmake by including the crow/include folder.
    Im using wsl2 with ubuntu 22.04. To that extend i just downloaded libboost-dev-all or whatever the specific name was but when i try to build the project it complained that it cannot find asio.hpp even tho i can definitely see the boost lib in /usr/include.

    After that i just added /usr/include/boost to the traget_include_directiories but now i get a bunch of other errors about asio not being defined and whatnot. Any tips? (am somewhat new to c++ and its ecosystem so good chance i did something dumb)

    Serenity
    @Daniele122898
    @The-EDev (sorry for the tag just assume its easier to reach you like this since the chat seems a little dead)
    Serenity
    @Daniele122898
    seems i had to install the asio headers seperately... now it works
    Luca Schlecker
    @luca-schlecker
    Hi Serenity, Crow doesn't require boost anymore, instead it just depends on the standalone asio library. ☺️
    narcisC22
    @narcisC22
    Hello,
    Farook Al-Sammarraie
    @The-EDev
    Hi
    narcisC22
    @narcisC22

    Hello, I have a question related to the certificates with Crow. I'm using a signed certificate chain with root CA. If a SSL certificate is hosted on a port, then all of its three certificate chains has to be printed, else it will be considered as Self signed as the Intermediate and Root CA is not mapped.

    I have hosted the certificate on the specified , it shows only the child certificate (Certificate #0 ). (command: keytool -sslserver <IP>:<port> -printcert )
    To use the certificate, I use ssl_file(const std::string& crt_filename, const std::string& key_filename) method.
    Should I use ssl_chainfile(const std::string& crt_filename, const std::string& key_filename) ?

    Farook Al-Sammarraie
    @The-EDev
    I'm not 100% sure, but ssl_chainfile was written for chained certificates. Although I should give a warning, it is best to hook Crow up to a proxy such as nginx or apache and let that handle SSL. only use Crow's SSL feature if you need to
    1 reply
    Serenity
    @Daniele122898
    image.png
    how do i nicely deal with this issue? Is there a returnable specifically for error cases that i dont seem to find? or how can these be mixed?
    nvm i was being blind af you can just wrap the returnable in the response mb!
    m8354801
    @m8354801
    how should I best allow users to enter newlines into posts and have mustache not remove them?
    1 reply
    nicheng0019
    @nicheng0019
    hello, I get boost::system::error_code 125 when the app receives many messanges simultaneously, should I modify some parameters?
    3 replies
    Olivia (Zoe)
    @LunarWatcher
    How do crow projects generally deal with partials and HTML template reuse? Couldn't find (m)any references to partials in general in the context of crow
    5 replies
    Jef
    @jef:rustybever.be
    [m]
    how does crow handle free'ing values returned from a route? my code interacts with some C code so some of my routes return crow::response(res) where res is a char*, and i'd like to avoid memory leaks where possible
    8 replies
    Jef
    @jef:rustybever.be
    [m]
    does crow load an entire POST request's body into memory if the body hasn't been accessed yet? and if so, is there a point in processing of a request (e.g. during middlewares) where this isn't the case yet? I'd like to check whether a request is authenticated without the entire request having to be loaded into memory first
    2 replies
    Ghost
    @ghost~637f1de06da03739849fd7e3
    Can I combine swagger and crow?
    1 reply
    Ghost
    @ghost~637f1de06da03739849fd7e3
    when I build using g++ my templates page load successfully but if I build it with CMake it shows template "text.html" not found. any suggestion?
    7 replies
    Jef
    @jef:rustybever.be
    [m]

    I'm having some trouble embedding a very simple html file in my binary, I currently have this

    std::string index_page = R"(
    <!DOCTYPE html>
    <html>
      <body>
      <p>Hello World!</p>
      </body>
    </html>
    )";

    which I then try to return like this

      CROW_ROUTE(app, "/").methods(crow::HTTPMethod::Get)([]() {
          return crow::response("text/html", index_page);
          });

    however I'm getting the following error when requesting the route

    (2022-11-27 18:02:52) [INFO    ] Request: 127.0.0.1:54736 0x555c60f94770 HTTP/1.1 GET /
    (2022-11-27 18:02:52) [ERROR   ] An uncaught exception occurred: unordered_map::at
    (2022-11-27 18:02:52) [INFO    ] Response: 0x555c60f94770 / 500 0

    any ideas? could this be related to the fact that I also have a /<string> GET route?

    I'd like to embed the file into the binary, as it'll just be a very simple index file
    Jef
    @jef:rustybever.be
    [m]
    ah i figured it out, the content_type argument doesn't expect the literal value for the header, but rather one of the keys defined here, so the correct value was just "html"
    Md.Soykot
    @soykot2910
    I want to establish a connection with a server that requires a login and password. The connection will be established only when I run the program, not with each request. It is possible to accomplish this with crow. I am currently using the cpp rest sdk.
    Farook Al-Sammarraie
    @The-EDev
    @soykot2910 do you mean you want to use Crow to connect to another server or have a client connect to crow and provide a username and password once?
    4 replies
    Jef
    @jef:rustybever.be
    [m]
    crow is a server framework, not a client one
    Serenity
    @Daniele122898
    how can i associate a websocket connection, with its onaccept call? So in the onaccept i require an authentication header to be present, to which i can associate a userId to. But i have no way of passing that knowledge along somehow to the other methods were i'll finally get a websocket&. i see that there used to be userData pointer but thats gone now. How can i do this association now?
    Serenity
    @Daniele122898
    master seems to still have it, yet the newest tag doesnt.
    Farook Al-Sammarraie
    @The-EDev
    @Daniele122898 The newest tag is older than master, the userdata pointer was added after v1.0
    Serenity
    @Daniele122898
    i see, i expected the docs to be outdated instead of newer. I dont like using master branches as those are usually still kinda dev like. is the crow master branch somewhat stable?
    Farook Al-Sammarraie
    @The-EDev
    While the releases are definitely more stable than master, master has been quite stable for some time