Static file serving
This commit is contained in:
parent
08353a717f
commit
84921f7db3
3 changed files with 50 additions and 11 deletions
45
Cargo.lock
generated
45
Cargo.lock
generated
|
@ -887,6 +887,12 @@ dependencies = [
|
|||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http-range-header"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08a397c49fec283e3d6211adbe480be95aae5f304cfb923e9970e08956d5168a"
|
||||
|
||||
[[package]]
|
||||
name = "httparse"
|
||||
version = "1.8.0"
|
||||
|
@ -1543,6 +1549,7 @@ dependencies = [
|
|||
"thiserror",
|
||||
"tokio",
|
||||
"toml 0.7.8",
|
||||
"tower-http",
|
||||
"ureq 2.7.1",
|
||||
"url",
|
||||
"winres",
|
||||
|
@ -2585,6 +2592,19 @@ dependencies = [
|
|||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-util"
|
||||
version = "0.7.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.5.11"
|
||||
|
@ -2644,6 +2664,31 @@ dependencies = [
|
|||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower-http"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5"
|
||||
dependencies = [
|
||||
"bitflags 2.4.0",
|
||||
"bytes",
|
||||
"futures-util",
|
||||
"http 1.1.0",
|
||||
"http-body",
|
||||
"http-body-util",
|
||||
"http-range-header",
|
||||
"httpdate",
|
||||
"mime",
|
||||
"mime_guess",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower-layer"
|
||||
version = "0.3.2"
|
||||
|
|
|
@ -36,13 +36,14 @@ simplelog = "0.12.0"
|
|||
thiserror = "1.0.37"
|
||||
tokio = { version = "1.38", features = ["macros", "rt-multi-thread"] }
|
||||
toml = "0.7"
|
||||
tower-http = { version = "0.5.2", features = ["fs"] }
|
||||
ureq = "2.7"
|
||||
url = "2.3"
|
||||
|
||||
[dependencies.axum]
|
||||
version = "0.7.5"
|
||||
default-features = false
|
||||
features = ["http1", "json", "tokio", "tower-log", "tracing", "query"]
|
||||
features = ["http1", "json", "tokio", "tower-log", "query"]
|
||||
|
||||
[dependencies.image]
|
||||
version = "0.24.4"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use axum::Router;
|
||||
use tower_http::services::ServeDir;
|
||||
|
||||
use crate::app::App;
|
||||
|
||||
|
@ -9,6 +10,8 @@ pub mod test;
|
|||
|
||||
pub fn make_router(app: App) -> Router {
|
||||
Router::new()
|
||||
.nest_service("/swagger", ServeDir::new(app.swagger_dir_path))
|
||||
.nest_service("/", ServeDir::new(app.web_dir_path))
|
||||
// move |cfg: &mut ServiceConfig| {
|
||||
// cfg.app_data(web::Data::new(app.index))
|
||||
// .app_data(web::Data::new(app.config_manager))
|
||||
|
@ -24,16 +27,6 @@ pub fn make_router(app: App) -> Router {
|
|||
// .configure(api::make_config())
|
||||
// .wrap(NormalizePath::trim()),
|
||||
// )
|
||||
// .service(
|
||||
// actix_files::Files::new("/swagger", app.swagger_dir_path)
|
||||
// .redirect_to_slash_directory()
|
||||
// .index_file("index.html"),
|
||||
// )
|
||||
// .service(
|
||||
// actix_files::Files::new("/", app.web_dir_path)
|
||||
// .redirect_to_slash_directory()
|
||||
// .index_file("index.html"),
|
||||
// );
|
||||
// }
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue