mirror of
https://github.com/actix/actix-website
synced 2024-11-30 11:12:57 +01:00
20 lines
594 B
Rust
20 lines
594 B
Rust
// <minfo>
|
|
use actix_web::{get, App, HttpRequest, HttpServer, Result};
|
|
|
|
#[get("/a/{v1}/{v2}/")]
|
|
async fn index(req: HttpRequest) -> Result<String> {
|
|
let v1: u8 = req.match_info().get("v1").unwrap().parse().unwrap();
|
|
let v2: u8 = req.match_info().query("v2").parse().unwrap();
|
|
let (v3, v4): (u8, u8) = req.match_info().load().unwrap();
|
|
Ok(format!("Values {} {} {} {}", v1, v2, v3, v4))
|
|
}
|
|
|
|
#[actix_web::main]
|
|
async fn main() -> std::io::Result<()> {
|
|
HttpServer::new(|| App::new().service(index))
|
|
.bind(("127.0.0.1", 8080))?
|
|
.run()
|
|
.await
|
|
}
|
|
// </minfo>
|