1
0
mirror of https://github.com/actix/actix-website synced 2025-02-23 20:53:01 +01:00

21 lines
408 B
Rust
Raw Normal View History

2019-06-16 23:17:17 -04:00
// <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>