1
0
mirror of https://github.com/actix/actix-website synced 2025-03-20 14:45:18 +01:00
2019-06-16 23:17:17 -04:00

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>