// use actix_web::{get, App, HttpRequest, HttpServer, Responder}; #[get("/")] async fn index(req: HttpRequest) -> impl Responder { let url = req.url_for("youtube", &["oHg5SJYRHA0"]).unwrap(); assert_eq!(url.as_str(), "https://youtube.com/watch/oHg5SJYRHA0"); url.into_string() } #[actix_web::main] async fn main() -> std::io::Result<()> { HttpServer::new(|| { App::new() .service(index) .external_resource("youtube", "https://youtube.com/watch/{video_id}") }) .bind("127.0.0.1:8080")? .run() .await } //