feat: axum type 0.7
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
393be43db1
commit
13756ba6ac
520
Cargo.lock
generated
520
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -13,8 +13,8 @@ tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
|
|||||||
clap = {version = "4.4.7", features = ["derive", "env"]}
|
clap = {version = "4.4.7", features = ["derive", "env"]}
|
||||||
async-trait = {version = "0.1.74", features = []}
|
async-trait = {version = "0.1.74", features = []}
|
||||||
|
|
||||||
axum = {version = "0.6.20", features = []}
|
axum = { git = "https://github.com/tokio-rs/axum", branch = "main", features = ["macros"] }
|
||||||
axum-extra = {version = "0.8.0", features = ["cookie", "cookie-private"]}
|
axum-extra = {git = "https://github.com/tokio-rs/axum", branch = "main" , features = ["cookie", "cookie-private", "typed-header"]}
|
||||||
axum-sessions = {version = "0.6.1", features = []}
|
axum-sessions = {version = "0.6.1", features = []}
|
||||||
async-sqlx-session = {version = "0.4.0", features = ["pg"]}
|
async-sqlx-session = {version = "0.4.0", features = ["pg"]}
|
||||||
|
|
||||||
|
@ -26,4 +26,4 @@ openidconnect.workspace = true
|
|||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tokio.workspace = true
|
tokio.workspace = true
|
||||||
pretty_assertions.workspace = true
|
pretty_assertions.workspace = true
|
||||||
sealed_test.workspace = true
|
sealed_test.workspace = true
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
|
|
||||||
use axum::extract::{FromRef, FromRequestParts, Query, State};
|
use axum::extract::{FromRef, FromRequestParts, Query, State};
|
||||||
|
|
||||||
use axum::headers::authorization::Basic;
|
|
||||||
use axum::headers::{Authorization, Cookie};
|
|
||||||
use axum::http::request::Parts;
|
use axum::http::request::Parts;
|
||||||
use axum::http::StatusCode;
|
use axum::http::StatusCode;
|
||||||
|
|
||||||
use axum::response::{ErrorResponse, IntoResponse, Redirect};
|
use axum::response::{ErrorResponse, IntoResponse, Redirect};
|
||||||
use axum::routing::get;
|
use axum::routing::get;
|
||||||
use axum::{async_trait, Json, RequestPartsExt, Router, TypedHeader};
|
use axum::{async_trait, Json, RequestPartsExt, Router};
|
||||||
|
|
||||||
|
use axum_extra::headers::authorization::Basic;
|
||||||
|
use axum_extra::headers::{Authorization, Cookie};
|
||||||
|
use axum_extra::TypedHeader;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use std::net::SocketAddr;
|
use std::{net::SocketAddr, str::FromStr};
|
||||||
|
|
||||||
use axum::{
|
use axum::{
|
||||||
extract::{FromRef, State},
|
extract::{FromRef, State},
|
||||||
@ -58,13 +58,10 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
.with_state(state)
|
.with_state(state)
|
||||||
.nest("/auth", AuthController::new_router(auth_service).await?);
|
.nest("/auth", AuthController::new_router(auth_service).await?);
|
||||||
|
|
||||||
let addr = SocketAddr::from(([127, 0, 0, 1], 3001));
|
let addr = SocketAddr::from_str(&format!("{}:{}", "127.0.0.1", "3000"))?;
|
||||||
println!("listening on: {addr}");
|
let listener = tokio::net::TcpListener::bind(&addr).await?;
|
||||||
println!("open browser at: http://localhost:3001/auth/zitadel");
|
|
||||||
axum::Server::bind(&addr)
|
axum::serve(listener, app).await?;
|
||||||
.serve(app.into_make_service())
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use std::net::SocketAddr;
|
use std::{net::SocketAddr, str::FromStr};
|
||||||
|
|
||||||
use axum::{
|
use axum::{
|
||||||
extract::{FromRef, State},
|
extract::{FromRef, State},
|
||||||
@ -57,10 +57,11 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
let addr = SocketAddr::from(([127, 0, 0, 1], 3001));
|
let addr = SocketAddr::from(([127, 0, 0, 1], 3001));
|
||||||
println!("listening on: {addr}");
|
println!("listening on: {addr}");
|
||||||
println!("open browser at: http://localhost:3001/auth/zitadel");
|
println!("open browser at: http://localhost:3001/auth/zitadel");
|
||||||
axum::Server::bind(&addr)
|
|
||||||
.serve(app.into_make_service())
|
let addr = SocketAddr::from_str(&format!("{}:{}", "127.0.0.1", "3000"))?;
|
||||||
.await
|
let listener = tokio::net::TcpListener::bind(&addr).await?;
|
||||||
.unwrap();
|
|
||||||
|
axum::serve(listener, app).await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user