+ An actix app comes with a URL routing system that lets you match on + URLs and invoke individual handlers. For extra flexibility scopes + can be used. +
+ {{ highlight `fn index(req: HttpRequest) -> impl Responder { + "Hello from the index page" +} + +fn hello(req: HttpRequest) -> impl Responder { + format!("Hello {}!", req.match_info().get("name").unwrap()) +} + +fn main() { + App::new() + .resource("/", |r| r.method(Method::Get).with(index)) + .resource("/hello/{name}", |r| r.method(Method::Get).with(hello)) + .finish(); }` "rust" "" }}