mirror of
https://github.com/actix/actix-website
synced 2025-02-09 23:05:37 +01:00
16 lines
353 B
Rust
16 lines
353 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))
|
|
}
|
|
|
|
pub fn main() {
|
|
App::new().route(
|
|
"/{username}/{id}/index.html", // <- define path parameters
|
|
web::get().to(index),
|
|
);
|
|
}
|
|
// </path>
|