1
0
mirror of https://github.com/actix/actix-website synced 2025-07-07 03:43:57 +02:00
Files
actix-website/examples/url-dispatch/src/path.rs
2019-06-17 02:08:42 -04:00

16 lines
349 B
Rust

// <path>
use actix_web::{web, App, Result};
// extract path info using serde
fn index(info: web::Path<(String, u32)>) -> Result<String> {
Ok(format!("Welcome {}! id: {}", info.0, info.1))
}
fn main() {
App::new().route(
"/{username}/{id}/index.html", // <- define path parameters
web::get().to(index),
);
}
// </path>