1
0
mirror of https://github.com/actix/actix-website synced 2024-12-03 20:22:13 +01:00
actix-website/examples/url-dispatch/src/pbuf.rs

16 lines
365 B
Rust
Raw Normal View History

2018-05-24 19:13:55 +02:00
// <pbuf>
use actix_web::{http::Method, App, HttpRequest, Result};
use std::path::PathBuf;
2018-07-21 14:21:41 +02:00
fn index(req: &HttpRequest) -> Result<String> {
2018-05-24 19:13:55 +02:00
let path: PathBuf = req.match_info().query("tail")?;
Ok(format!("Path {:?}", path))
}
fn main() {
App::new()
.resource(r"/a/{tail:.*}", |r| r.method(Method::GET).f(index))
.finish();
}
// </pbuf>