♻️ 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:
parent
019961ed77
commit
c1afe0e70c
30 changed files with 393 additions and 355 deletions
|
|
@ -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! {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue