🚧 [pagetop] Preparando liberación de la v0.1.0

This commit is contained in:
Manuel Cillero 2025-08-03 14:17:22 +02:00
parent 223a98569b
commit fe81ed1cd7
6 changed files with 144 additions and 2 deletions

24
examples/hello-name.rs Normal file
View file

@ -0,0 +1,24 @@
use pagetop::prelude::*;
struct HelloName;
impl Extension for HelloName {
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
scfg.route("/hello/{name}", service::web::get().to(hello_name));
}
}
async fn hello_name(
request: HttpRequest,
path: service::web::Path<String>,
) -> ResultPage<Markup, ErrorPage> {
let name = path.into_inner();
Page::new(Some(request))
.with_component(Html::with(move |_| html! { h1 { "Hello " (name) "!" } }))
.render()
}
#[pagetop::main]
async fn main() -> std::io::Result<()> {
Application::prepare(&HelloName).run()?.await
}