update axum to 7

This commit is contained in:
Sebastian Hugentobler 2024-03-08 09:43:30 +01:00
parent 660f7644fc
commit ba3ad10fff
Signed by: shu
GPG key ID: BB32CF3CA052C2F0
4 changed files with 125 additions and 38 deletions

View file

@ -22,8 +22,10 @@ async fn main() {
let app = app::create(feeds);
tracing::debug!("Listening on {}", addr);
axum::Server::bind(&addr)
.serve(app.into_make_service())
let listener = tokio::net::TcpListener::bind(&addr)
.await
.expect("Faileds to listen on the specified address");
axum::serve(listener, app.into_make_service())
.with_graceful_shutdown(signals::shutdown())
.await
.expect("Failed to start server");

View file

@ -1,10 +1,10 @@
use std::sync::Arc;
use axum::{body::Body, routing::get, Router};
use axum::{routing::get, Router};
use crate::{app::AppState, feeds};
pub fn all() -> Router<Arc<AppState>, Body> {
pub fn all() -> Router<Arc<AppState>> {
Router::new()
.route("/", get(feeds::route::feeds))
.route("/feeds/:id", get(feeds::route::feed))