Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Zeppelin
    @zpallin
    @cburgdorf Hey! I noticed you're sort of doing some work with nickel recently, so would you be able to elaborate on the status of development for this repo? I'm new to this repo and in general Rust, but I would like to get involved somehow and it seems like the repo is mostly inactive atm.
    Rust
    @LooMaclin
    hi all
    when i try to send with axios POST request to nickel-backend-service i'm get error with message "XMLHttpRequest cannot load http://localhost:8081/sample. Response for preflight has invalid HTTP status code 404" in browser console. In nickel-backend i'm enable cors.
    @Ryman @cburgdorf can you help me?
    Sebastian Blei
    @iamsebastian
    Go into your browser, copy the Request as cURL and paste it here.
    When your preflight get responded with 404, than there's no CORS enabled, maybe.
    Rust
    @LooMaclin
    @iamsebastian ok
    curl 'http://localhost:8081/sample' -X OPTIONS -H 'Access-Control-Request-Method: POST' -H 'Origin: http://localhost:8080' -H 'Accept-Encoding: gzip, deflate, sdch, br' -H 'Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.90 Safari/537.36' -H 'Accept: */*' -H 'Referer: http://localhost:8080/login' -H 'Connection: keep-alive' -H 'Access-Control-Request-Headers: content-type' --compressed
    Sebastian Blei
    @iamsebastian
    Can you show the code of your CORS implementation?
    Rust
    @LooMaclin
    @iamsebastian yep
    i'm change example in nickel repo. add allowing methods
    fn enable_cors<'mw>(_req: &mut Request, mut res: Response<'mw>) -> MiddlewareResult<'mw> {
        // Set appropriate headers
        res.set(AccessControlAllowOrigin::Any);
    
        res.set(AccessControlAllowMethods(vec![
            Method::Get,
            Method::Post,
            Method::Options,
            Method::Delete,
            ])
        );
        res.set(AccessControlAllowHeaders(vec![
        // Hyper uses the `unicase::Unicase` type to ensure comparisons are done
        // case-insensitively. Here, we use `into()` to convert to one from a `&str`
        // so that we don't have to import the type ourselves.
        "Origin".into(),
        "X-Requested-With".into(),
        "Content-Type".into(),
        "Accept".into(),
        ]));
    
        // Pass control to the next middleware
        res.next_middleware()
    }
    Sebastian Blei
    @iamsebastian
    Yeah, looks original.
    Can you post the code of your Router?
    Rust
    @LooMaclin
        server.post("/sample", middleware! { |request, response|
            (StatusCode::Ok, "Ok")
        });
    Sebastian Blei
    @iamsebastian
    And where did you utilize the server with the CORS middleware?
    Rust
    @LooMaclin
    @iamsebastian yep
    Sebastian Blei
    @iamsebastian
    You've also written a preflight middleware?
    Rust
    @LooMaclin
    @iamsebastian i'm use PostgresMiddleware
    and nickel-jwt-session
    Rust
    @LooMaclin
    but..i'm disabled this for debugging cors post problem
    Sebastian Blei
    @iamsebastian
    Sorry, had a meeting.
    You need to implement a preflight middleware, @LooMaclin. Otherwise, it's not possible for your frontend to do preflights.
    Here's mine:
    pub fn enable_options_preflight<'mw>(_req: &mut Request, mut res: Response<'mw>) -> MiddlewareResult<'mw> {
        // Set HTTP 200.
        // ContentType should be text/plain.
        res.set(Ok)
            .set(ContentType::plaintext());
        // Just "ok" as response text.
        res.send("Ok")
    }
    And implement it at one of the first points on your Nickel::Server:
    srv.options("**/*", middlewares::enable_options_preflight);
    Rust
    @LooMaclin
    @iamsebastian thx, i'm try this and send feedback
    Sebastian Blei
    @iamsebastian
    :)
    Alex Creamer
    @AlexCreamer
    Hi, can someone help me out with a couple of my bugs?
    One of them is that when using Atom with remote-server using rmate on a remote server, I get error saying that the "nickel" crate was unable to be found.
    Second, how do I handle form submittions using Nickel?
    Alex Creamer
    @AlexCreamer
    Fixed!
    Emīls Piņķis
    @pinkisemils
    anyone here used diesel with foreign keys ?
    Denis Lisov
    @tanriol
    Sorry for being rough, but is Nickel still alive? The activity level seems to be zero these days...
    Sebastian Blei
    @iamsebastian
    @pinkisemils Yes. Sorry for late answer. :)
    @tanriol Does not seems to be.
    Azzuwan Aziz
    @azzuwan
    Hey guys
    Who here has experience running Nickel in prod?
    Just a curious question :)
    Denis Lisov
    @tanriol
    The activity here is pretty minimal these days.
    Sebastian Blei
    @iamsebastian
    @azzuwan /me
    Sorry for late response
    Oh ... late . .. 5 weeks ago. :clap:
    Lorenzo Iannuzzi
    @lorenzoi
    anyone on?
    Sebastian Blei
    @iamsebastian
    True
    Lorenzo Iannuzzi
    @lorenzoi
    LaTeXLaTeX
    oops sorry
    Sebastian Blei
    @iamsebastian
    np
    Lorenzo Iannuzzi
    @lorenzoi
    when I run Nickel with a template I get a internal server error. You know how to help?
    Sebastian Blei
    @iamsebastian
    Run your server with RUST_BACKTRACE=1 RUST_LOG=info and try it again
    Lorenzo Iannuzzi
    @lorenzoi
    ok
    Sebastian Blei
    @iamsebastian
    Then you've maybe enough info for debugging.
    Lorenzo Iannuzzi
    @lorenzoi
    works now :) Thanks
    Sebastian Blei
    @iamsebastian
    You're welcome.
    LeonineKing1199
    @LeonineKing1199
    How does this library compare to the premiere tech stack of 2019, Beast/Asio?
    For example, I'm not sure if I'm a fan of routing being done for me
    I'm a huge fan of PEGging when I need to parse something
    Also, Beast had a formal security audit
    Has this been audited as well?
    I'm thinking about switching but need to make sure some things are in place