kamil-koziol / goat-web-server

0 stars 0 forks source link

Pass params as arguments to function #1

Open kamil-koziol opened 4 months ago

kamil-koziol commented 4 months ago

Transform

pub fn echo(_request: &Request, _params: RouteParams) -> Result<Response> {
    let msg = _params.params.get("msg").unwrap();
    // ...
}

to

pub fn echo(_request: &Request, msg: String) -> Result<Response> {
    // ...
}
kamil-koziol commented 4 months ago

https://promethia-27.github.io/dependency_injection_like_bevy_from_scratch/introductions.html