📝 Document route access and custom authentication
Adapt the guides to the current PageTop API: Routes with the access of each route, Layers, StaticFiles and the administration panel in the core, with pagetop-admin reduced to the settings forms. Add the "Connect your own authentication" guide, the mail test page and the admin_path setting, and explain route access in the architecture page. Mount the books with their access through pagetop-mdbook.
This commit is contained in:
parent
f42f5e9b89
commit
345bd26974
41 changed files with 869 additions and 368 deletions
|
|
@ -98,8 +98,8 @@ impl Extension for GardenTasks {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn configure_router(&self, router: Router) -> Router {
|
||||
router.route("/", web::get(home))
|
||||
fn configure_router(&self, routes: Routes) -> Routes {
|
||||
routes.public_route("/", web::get(home))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -162,10 +162,10 @@ impl Extension for GardenTasks {
|
|||
|
||||
// ... initialize() as before ...
|
||||
|
||||
fn configure_router(&self, router: Router) -> Router {
|
||||
router
|
||||
.route("/", web::get(home))
|
||||
.route("/tasks", web::post(create))
|
||||
fn configure_router(&self, routes: Routes) -> Routes {
|
||||
routes
|
||||
.public_route("/", web::get(home))
|
||||
.public_route("/tasks", web::post(create))
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
@ -329,7 +329,8 @@ async fn toggle(web::Path(id): web::Path<u32>) -> Response {
|
|||
}
|
||||
```
|
||||
|
||||
Regístrala con `.route("/tasks/{id}/toggle", web::patch(toggle))`. Marca una tarea: queda tachada.
|
||||
Regístrala con `.public_route("/tasks/{id}/toggle", web::patch(toggle))`. Marca una tarea:
|
||||
queda tachada.
|
||||
|
||||
## 5. El contador, fuera de banda
|
||||
|
||||
|
|
@ -413,7 +414,7 @@ async fn remove(web::Path(id): web::Path<u32>) -> Response {
|
|||
}
|
||||
```
|
||||
|
||||
Regístrala en la ruta de cada tarea: `.route("/tasks/{id}", web::delete(remove))`.
|
||||
Regístrala en la ruta de cada tarea: `.public_route("/tasks/{id}", web::delete(remove))`.
|
||||
|
||||
## 7. Editar en línea
|
||||
|
||||
|
|
@ -500,13 +501,13 @@ Las rutas quedan así:
|
|||
# struct GardenTasks;
|
||||
# #[async_trait]
|
||||
# impl Extension for GardenTasks {
|
||||
fn configure_router(&self, router: Router) -> Router {
|
||||
router
|
||||
.route("/", web::get(home))
|
||||
.route("/tasks", web::post(create))
|
||||
.route("/tasks/{id}", web::get(show).put(update).delete(remove))
|
||||
.route("/tasks/{id}/edit", web::get(edit))
|
||||
.route("/tasks/{id}/toggle", web::patch(toggle))
|
||||
fn configure_router(&self, routes: Routes) -> Routes {
|
||||
routes
|
||||
.public_route("/", web::get(home))
|
||||
.public_route("/tasks", web::post(create))
|
||||
.public_route("/tasks/{id}", web::get(show).put(update).delete(remove))
|
||||
.public_route("/tasks/{id}/edit", web::get(edit))
|
||||
.public_route("/tasks/{id}/toggle", web::patch(toggle))
|
||||
}
|
||||
# }
|
||||
```
|
||||
|
|
@ -558,13 +559,13 @@ ciclo completo de una tarea:
|
|||
# store().add("Turn the compost".into());
|
||||
# Ok(())
|
||||
# }
|
||||
# fn configure_router(&self, router: Router) -> Router {
|
||||
# router
|
||||
# .route("/", web::get(home))
|
||||
# .route("/tasks", web::post(create))
|
||||
# .route("/tasks/{id}", web::get(show).put(update).delete(remove))
|
||||
# .route("/tasks/{id}/edit", web::get(edit))
|
||||
# .route("/tasks/{id}/toggle", web::patch(toggle))
|
||||
# fn configure_router(&self, routes: Routes) -> Routes {
|
||||
# routes
|
||||
# .public_route("/", web::get(home))
|
||||
# .public_route("/tasks", web::post(create))
|
||||
# .public_route("/tasks/{id}", web::get(show).put(update).delete(remove))
|
||||
# .public_route("/tasks/{id}/edit", web::get(edit))
|
||||
# .public_route("/tasks/{id}/toggle", web::patch(toggle))
|
||||
# }
|
||||
# }
|
||||
# async fn home(request: HttpRequest) -> Result<Markup, ErrorPage> {
|
||||
|
|
@ -821,13 +822,13 @@ impl Extension for GardenTasks {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn configure_router(&self, router: Router) -> Router {
|
||||
router
|
||||
.route("/", web::get(home))
|
||||
.route("/tasks", web::post(create))
|
||||
.route("/tasks/{id}", web::get(show).put(update).delete(remove))
|
||||
.route("/tasks/{id}/edit", web::get(edit))
|
||||
.route("/tasks/{id}/toggle", web::patch(toggle))
|
||||
fn configure_router(&self, routes: Routes) -> Routes {
|
||||
routes
|
||||
.public_route("/", web::get(home))
|
||||
.public_route("/tasks", web::post(create))
|
||||
.public_route("/tasks/{id}", web::get(show).put(update).delete(remove))
|
||||
.public_route("/tasks/{id}/edit", web::get(edit))
|
||||
.public_route("/tasks/{id}/toggle", web::patch(toggle))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue