MCPcopy Create free account
hub / github.com/actix/examples / with_param

Function with_param

basics/basics/src/main.rs:71–77  ·  view source on GitHub ↗

handler with path parameters like `/user/{name}`

(req: HttpRequest, Path((name,)): Path<(String,)>)

Source from the content-addressed store, hash-verified

69
70/// handler with path parameters like `/user/{name}`
71async fn with_param(req: HttpRequest, Path((name,)): Path<(String,)>) -> HttpResponse {
72 println!("{req:?}");
73
74 HttpResponse::Ok()
75 .content_type(ContentType::plaintext())
76 .body(format!("Hello {name}!"))
77}
78
79#[actix_web::main]
80async fn main() -> io::Result<()> {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected