diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..e7ba845 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[env] +STATIC_FILE_PATH = { value = "static", relative = true } \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..24a8e87 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.png filter=lfs diff=lfs merge=lfs -text diff --git a/Cargo.toml b/Cargo.toml index 70fde55..ce86395 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,3 +10,4 @@ tokio = { version = "1", features = ["rt-multi-thread"]} axum = "0.7" askama = "0.12" askama_axum = "0.4" +tower-http = { version = "0.5", features = ["fs"] } diff --git a/src/main.rs b/src/main.rs index 3d5f385..ef15f19 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,9 +1,13 @@ +use std::env; use askama::Template; use axum::{routing::get, Router}; +use tower_http::services::ServeDir; #[tokio::main] async fn main() -> Result<(), Box> { - let app = Router::new().route("/", get(root)); + let app = Router::new() + .route("/", get(root)) + .nest_service("/static", ServeDir::new(env::var("STATIC_FILE_PATH")?)); let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await?; axum::serve(listener, app).await?; diff --git a/static/favicon-16.png b/static/favicon-16.png new file mode 100644 index 0000000..78b6f0c --- /dev/null +++ b/static/favicon-16.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:931474c19b9636db73b1f49667ee0ae1e3a5d45effa05b3211171292cbb19a58 +size 933 diff --git a/static/favicon-167.png b/static/favicon-167.png new file mode 100644 index 0000000..b6c50b4 --- /dev/null +++ b/static/favicon-167.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:887bf5da648e462c94fa27adf22d25ee9527d6bbc91bfd8cb7b75c21accd7a5f +size 6596 diff --git a/static/favicon-180.png b/static/favicon-180.png new file mode 100644 index 0000000..99ea589 --- /dev/null +++ b/static/favicon-180.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fc6c773242005fad1b9f1c540e8bc23d463187e4a1c26b4bbe8a946beea162b6 +size 6998 diff --git a/static/favicon-192.png b/static/favicon-192.png new file mode 100644 index 0000000..f1fd67b --- /dev/null +++ b/static/favicon-192.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79937212e248a746caf7f8d33b4c77b0d30140894a0da2ff5cc32db9e9efc879 +size 7388 diff --git a/static/favicon-32.png b/static/favicon-32.png new file mode 100644 index 0000000..881e839 --- /dev/null +++ b/static/favicon-32.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e0d1765043cd8606b825a9ccc3f0d1864ddb661099be908a7cc8a51d49d2a20 +size 1545 diff --git a/static/favicon-48.png b/static/favicon-48.png new file mode 100644 index 0000000..9157c86 --- /dev/null +++ b/static/favicon-48.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b26943b702fb5c64b97cf7acf463e2fc72fb973dfd448ba9618dd8fb494b0a68 +size 2130 diff --git a/templates/index.html b/templates/index.html index d925a10..56f24a3 100644 --- a/templates/index.html +++ b/templates/index.html @@ -4,6 +4,16 @@ {{title}} + + + + + + + + + + It still works!