Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Awkward Method Name #51

Open
thehydroimpulse opened this issue Oct 29, 2014 · 2 comments
Open

Awkward Method Name #51

thehydroimpulse opened this issue Oct 29, 2014 · 2 comments

Comments

@thehydroimpulse
Copy link

Having something like mount.mount is extremely awkward.

Something like on might serve better:

fn send_hello(req: &mut Request) -> IronResult<Response> {
    Ok(Response::with(status::Ok, "Hello!"))
}

fn intercept(req: &mut Request) -> IronResult<Response> {
    Ok(Response::with(status::Ok, "Blocked!"))
}

fn main() {
    let mut mount = Mount::new();
    mount.on("/blocked/", intercept).on("/", send_hello);

    Iron::new(mount).listen(Ipv4Addr(127, 0, 0, 1), 3000);
}
@reem
Copy link
Member

reem commented Feb 10, 2015

Agreed.

@reem
Copy link
Member

reem commented Mar 25, 2015

This change is currently in PR in #66, but needs to be rebased over other modernization changes.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants