1
0
Fork 0

Initial commit

This commit is contained in:
Adrian Hedqvist 2022-06-16 23:44:37 +02:00
commit b36176e300
5 changed files with 1225 additions and 0 deletions

2
.cargo/config.toml Normal file
View file

@ -0,0 +1,2 @@
[env]
RUST_LOG="debug"

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/target

1175
Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

16
Cargo.toml Normal file
View file

@ -0,0 +1,16 @@
[package]
name = "website"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
axum = { version = "0.5.7", features = ["http2"] }
color-eyre = "0.6.1"
hyper = { version = "0.14.19", features = ["full"] }
tokio = { version = "1.19.2", features = ["full"] }
tower = { version = "0.4.12", features = ["full"] }
tower-http = { version = "0.3.4", features = ["full"] }
tracing = "0.1.35"
tracing-subscriber = { version = "0.3.11", features = ["fmt"] }

31
src/main.rs Normal file
View file

@ -0,0 +1,31 @@
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(())
}