♻️ Migra API pública de actix-web a Axum

- `configure_service` como `configure_router(Router) -> Router`.
- Macro `static_files_service!` como `serve_static_files!`.
- `ResultPage<M, E>` eliminado; handlers devuelven `Result<M, E>`.
- `ErrorPage` implementa `IntoResponse` en lugar de `ResponseError`.
- Registro con `OnceLock`; eliminados `drop_extensions` y `app.welcome`.
- `Redirect` devuelve `Response`; docs y ejemplos actualizados.
This commit is contained in:
Manuel Cillero 2026-05-31 23:38:43 +02:00
parent 019961ed77
commit c1afe0e70c
30 changed files with 393 additions and 355 deletions

View file

@ -11,12 +11,12 @@ impl Extension for FormControls {
vec![&pagetop_aliner::Aliner, &pagetop_bootsier::Bootsier]
}
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
scfg.route("/", service::web::get().to(form_controls));
fn configure_router(&self, router: Router) -> Router {
router.route("/", web::get(form_controls))
}
}
async fn form_controls(request: HttpRequest) -> ResultPage<Markup, ErrorPage> {
async fn form_controls(request: HttpRequest) -> Result<Markup, ErrorPage> {
Page::new(request)
.with_child(
Intro::default()

View file

@ -3,16 +3,15 @@ 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));
fn configure_router(&self, router: Router) -> Router {
router.route("/hello/{name}", web::get(hello_name))
}
}
async fn hello_name(
request: HttpRequest,
path: service::web::Path<String>,
) -> ResultPage<Markup, ErrorPage> {
let name = path.into_inner();
web::Path(name): web::Path<String>,
) -> Result<Markup, ErrorPage> {
Page::new(request)
.with_child(Html::with(move |_| {
html! {

View file

@ -3,12 +3,12 @@ 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));
fn configure_router(&self, router: Router) -> Router {
router.route("/", web::get(hello_world))
}
}
async fn hello_world(request: HttpRequest) -> ResultPage<Markup, ErrorPage> {
async fn hello_world(request: HttpRequest) -> Result<Markup, ErrorPage> {
Page::new(request)
.with_child(Html::with(|_| {
html! {

View file

@ -5,12 +5,12 @@ include_locales!(LOC from "examples/locale");
struct IntroColors;
impl Extension for IntroColors {
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
scfg.route("/", service::web::get().to(intro_colors));
fn configure_router(&self, router: Router) -> Router {
router.route("/", web::get(intro_colors))
}
}
async fn intro_colors(request: HttpRequest) -> ResultPage<Markup, ErrorPage> {
async fn intro_colors(request: HttpRequest) -> Result<Markup, ErrorPage> {
Page::new(request)
.with_child(
Intro::default()

View file

@ -8,7 +8,11 @@ struct SuperMenu;
impl Extension for SuperMenu {
fn dependencies(&self) -> Vec<ExtensionRef> {
vec![&pagetop_aliner::Aliner, &pagetop_bootsier::Bootsier]
vec![
&pagetop_aliner::Aliner,
&pagetop_bootsier::Bootsier,
&pagetop::base::extension::Welcome,
]
}
fn initialize(&self) {