fix: Add static file serving to Rust backend
This commit is contained in:
parent
025110efae
commit
35c9bf24f7
2 changed files with 4 additions and 2 deletions
|
|
@ -9,6 +9,7 @@ use axum::{
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tower_http::cors::{Any, CorsLayer};
|
use tower_http::cors::{Any, CorsLayer};
|
||||||
|
use tower_http::services::ServeDir;
|
||||||
|
|
||||||
use crate::api::AppState;
|
use crate::api::AppState;
|
||||||
use crate::spotdl::SpotdlService;
|
use crate::spotdl::SpotdlService;
|
||||||
|
|
@ -30,6 +31,7 @@ async fn main() {
|
||||||
.route("/api/stream/{id}", get(api::stream_handler))
|
.route("/api/stream/{id}", get(api::stream_handler))
|
||||||
.route("/api/artist/info", get(api::artist_info_handler))
|
.route("/api/artist/info", get(api::artist_info_handler))
|
||||||
.route("/api/browse", get(api::browse_handler))
|
.route("/api/browse", get(api::browse_handler))
|
||||||
|
.nest_service("/", ServeDir::new("static"))
|
||||||
.layer(cors)
|
.layer(cors)
|
||||||
.with_state(app_state);
|
.with_state(app_state);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
services:
|
services:
|
||||||
spotify-clone:
|
spotify-clone:
|
||||||
image: git.khoavo.myds.me/vndangkhoa/spotify-clone:v4
|
image: git.khoavo.myds.me/vndangkhoa/spotify-clone:v5
|
||||||
container_name: spotify-clone
|
container_name: spotify-clone
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "3000:8080"
|
- "3110:8080"
|
||||||
environment:
|
environment:
|
||||||
- PORT=8080
|
- PORT=8080
|
||||||
- RUST_ENV=production
|
- RUST_ENV=production
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue