1
0
mirror of https://github.com/actix/actix-website synced 2024-12-01 03:24:36 +01:00
actix-website/examples/url-dispatch/src/pbuf.rs
2019-06-28 13:31:30 -04:00

20 lines
468 B
Rust

// <pbuf>
use actix_web::{HttpRequest, Result};
use std::path::PathBuf;
fn index(req: HttpRequest) -> Result<String> {
let path: PathBuf = req.match_info().query("tail").parse().unwrap();
Ok(format!("Path {:?}", path))
}
pub fn main() {
use actix_web::{web, App, HttpServer};
HttpServer::new(|| App::new().route(r"/a/{tail:.*}", web::get().to(index)))
.bind("127.0.0.1:8088")
.unwrap()
.run()
.unwrap();
}
// </pbuf>