feat(server): register upload route and static file serving
This commit is contained in:
parent
371ebcf8f9
commit
76797f1bc3
@ -21,7 +21,7 @@ tower-http = { version = "0.6", features = ["trace", "fs"], optional = true }
|
||||
rand = { version = "0.8", features = ["getrandom"] }
|
||||
getrandom = { version = "0.2", features = ["js"] }
|
||||
http = "1"
|
||||
axum = { version = "0.7", optional = true, features = ["multipart"] }
|
||||
axum = { version = "0.8", optional = true, features = ["multipart"] }
|
||||
serde_json = "1.0"
|
||||
ammonia = { version = "4", optional = true }
|
||||
syntect = { version = "5", default-features = false, features = ["default-syntaxes", "default-themes", "default-fancy", "html", "parsing", "dump-load", "yaml-load"], optional = true }
|
||||
|
||||
@ -45,6 +45,8 @@ fn main() {
|
||||
.invalidate_after(std::time::Duration::from_secs(300)),
|
||||
);
|
||||
let router = axum::Router::new()
|
||||
.route("/api/upload", axum::routing::post(crate::api::upload::upload_image))
|
||||
.nest_service("/uploads", tower_http::services::ServeDir::new("uploads"))
|
||||
.serve_dioxus_application(config, router::AppRouter)
|
||||
.layer(
|
||||
TraceLayer::new_for_http()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user