mirror of
https://github.com/actix/actix-website
synced 2025-02-23 20:53:01 +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>
|