(state: Data<&AppState>, Path(id): Path<i32>)
| 111 | |
| 112 | #[handler] |
| 113 | async fn delete(state: Data<&AppState>, Path(id): Path<i32>) -> Result<impl IntoResponse> { |
| 114 | let conn = &state.conn; |
| 115 | |
| 116 | MutationCore::delete_post(conn, id) |
| 117 | .await |
| 118 | .map_err(InternalServerError)?; |
| 119 | |
| 120 | Ok(StatusCode::FOUND.with_header("location", "/")) |
| 121 | } |
| 122 | |
| 123 | #[tokio::main] |
| 124 | async fn start() -> std::io::Result<()> { |