1
0
mirror of https://github.com/actix/actix-website synced 2025-02-02 12:19:04 +01:00
2018-05-24 10:13:55 -07:00

16 lines
389 B
Rust

// <path>
use actix_web::{http::Method, App, Path, Result};
// extract path info using serde
fn index(info: Path<(String, u32)>) -> Result<String> {
Ok(format!("Welcome {}! id: {}", info.0, info.1))
}
fn main() {
let app = App::new().resource(
"/{username}/{id}/index.html", // <- define path parameters
|r| r.method(Method::GET).with(index),
);
}
// </path>