Move axum stuff to separate module
This commit is contained in:
parent
6a1be899f7
commit
ec9b0993bc
2 changed files with 14 additions and 4 deletions
|
@ -20,8 +20,8 @@
|
|||
#![forbid(unsafe_code)]
|
||||
|
||||
mod auth;
|
||||
mod server;
|
||||
|
||||
use axum::{routing::get, Router};
|
||||
use color_eyre::Result;
|
||||
use tracing::{event, instrument, Level};
|
||||
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
|
||||
|
@ -50,9 +50,7 @@ async fn main() -> Result<()> {
|
|||
|
||||
event!(Level::INFO, "Hello, world!");
|
||||
|
||||
let app = Router::new().route("/tls-check/success", get(|| async { "OK" }));
|
||||
let listener = tokio::net::TcpListener::bind("[::]:8080").await?;
|
||||
axum::serve(listener, app).await?;
|
||||
tokio::spawn(server::run()).await??;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
12
src/server.rs
Normal file
12
src/server.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
use axum::{routing::get, Router};
|
||||
use color_eyre::Result;
|
||||
use tracing::instrument;
|
||||
|
||||
#[instrument]
|
||||
pub async fn run() -> Result<()> {
|
||||
let app = Router::new().route("/tls-check/success", get(|| async { "OK" }));
|
||||
let listener = tokio::net::TcpListener::bind("[::]:8080").await?;
|
||||
axum::serve(listener, app).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
Loading…
Reference in a new issue