mirror of
https://github.com/actix/actix-website
synced 2025-06-27 07:29:02 +02:00
migrate to docusaurus (v2) (#266)
Co-authored-by: ibraheemdev <ibrah1440@gmail.com>
This commit is contained in:
18
examples/url-dispatch/src/pbuf.rs
Normal file
18
examples/url-dispatch/src/pbuf.rs
Normal file
@ -0,0 +1,18 @@
|
||||
// <pbuf>
|
||||
use actix_web::{get, App, HttpRequest, HttpServer, Result};
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[get("/a/{tail:.*}")]
|
||||
async fn index(req: HttpRequest) -> Result<String> {
|
||||
let path: PathBuf = req.match_info().query("tail").parse().unwrap();
|
||||
Ok(format!("Path {:?}", path))
|
||||
}
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
HttpServer::new(|| App::new().service(index))
|
||||
.bind("127.0.0.1:8080")?
|
||||
.run()
|
||||
.await
|
||||
}
|
||||
// </pbuf>
|
Reference in New Issue
Block a user