pub fn generate(route_name: &str, parameters: HashMap<&str, String>) -> String
Expand description

Returns the uri for the given route name.

Examples

# routes.yaml

routes:
  - hello_world:
      path: /hello-world
      controller: hello_world
   - user:
      path: /user/{name}/{surname}
      controller: user_controller/index
use kalgan::service::url;

let hello_world_uri: String = url::generate("hello_world", HashMap::new());
assert_eq!(hello_world_uri, "/hello-world".to_string());

let mut parameters = HashMap::new();
parameters.insert("name", "john".to_string());
parameters.insert("surname", "doe".to_string());
let user_uri: String = url::generate("user", parameters);
assert_eq!(user_uri, "/user/john/doe".to_string());