proxy_template

Function proxy_template 

Source
pub fn proxy_template(template: impl Into<String>) -> TemplateTarget
Expand description

Create a new TemplateTarget with the given URL template.

This is a convenience function for creating template-based target resolvers.

§Arguments

  • template - A URL template with {param} placeholders

§Example

use axum::Router;
use axum_reverse_proxy::{ProxyRouterExt, proxy_template};

let app: Router = Router::new()
    .proxy_route("/api/{version}/{*path}", proxy_template("https://api.example.com/{version}/{path}"));