1
0
mirror of https://github.com/actix/actix-website synced 2024-12-02 19:52:23 +01:00
actix-website/examples/url-dispatch/src/pbuf.rs

20 lines
468 B
Rust
Raw Normal View History

2018-05-24 19:13:55 +02:00
// <pbuf>
2019-06-28 19:31:30 +02:00
use actix_web::{HttpRequest, Result};
2018-05-24 19:13:55 +02:00
use std::path::PathBuf;
2019-06-17 08:08:42 +02:00
fn index(req: HttpRequest) -> Result<String> {
let path: PathBuf = req.match_info().query("tail").parse().unwrap();
2018-05-24 19:13:55 +02:00
Ok(format!("Path {:?}", path))
}
pub fn main() {
2019-06-28 19:31:30 +02:00
use actix_web::{web, App, HttpServer};
2019-06-26 00:20:36 +02:00
HttpServer::new(|| App::new().route(r"/a/{tail:.*}", web::get().to(index)))
.bind("127.0.0.1:8088")
.unwrap()
.run()
.unwrap();
2018-05-24 19:13:55 +02:00
}
// </pbuf>