🚧 [pagetop] Preparando liberación de la v0.1.0
This commit is contained in:
parent
223a98569b
commit
fe81ed1cd7
6 changed files with 144 additions and 2 deletions
20
examples/hello-world.rs
Normal file
20
examples/hello-world.rs
Normal file
|
@ -0,0 +1,20 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
struct HelloWorld;
|
||||
|
||||
impl Extension for HelloWorld {
|
||||
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
|
||||
scfg.route("/", service::web::get().to(hello_world));
|
||||
}
|
||||
}
|
||||
|
||||
async fn hello_world(request: HttpRequest) -> ResultPage<Markup, ErrorPage> {
|
||||
Page::new(Some(request))
|
||||
.with_component(Html::with(move |_| html! { h1 { "Hello World!" } }))
|
||||
.render()
|
||||
}
|
||||
|
||||
#[pagetop::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
Application::prepare(&HelloWorld).run()?.await
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue