mirror of
https://github.com/actix/actix-website
synced 2025-03-20 14:45:18 +01:00
21 lines
408 B
Rust
21 lines
408 B
Rust
// <multi>
|
|
use actix_web::{web, App};
|
|
use serde::Deserialize;
|
|
|
|
#[derive(Deserialize)]
|
|
struct Info {
|
|
username: String,
|
|
}
|
|
|
|
fn index((_path, query): (web::Path<(u32, String)>, web::Query<Info>)) -> String {
|
|
format!("Welcome {}!", query.username)
|
|
}
|
|
|
|
pub fn main() {
|
|
App::new().route(
|
|
"/users/{userid}/{friend}", // <- define path parameters
|
|
web::get().to(index),
|
|
);
|
|
}
|
|
// </multi>
|