1
0
Fork 0
website/src/main.rs

32 lines
687 B
Rust
Raw Normal View History

2022-06-16 23:44:37 +02:00
use axum::{
Router,
routing::get
};
use tower_http::trace::TraceLayer;
use tracing::{debug, error, info, warn};
use color_eyre::eyre::Result;
#[tokio::main]
async fn main() -> Result<()> {
color_eyre::install()?;
tracing_subscriber::fmt::init();
info!("Starting server...");
let middleware = tower::ServiceBuilder::new()
.layer(TraceLayer::new_for_http());
let app = Router::new()
.route("/", get(|| async { "Hello world!" }))
.layer(middleware);
info!("Now listening at http://localhost:8180");
axum::Server::bind(&"0.0.0.0:8180".parse().unwrap())
.serve(app.into_make_service())
.await?;
Ok(())
}