chore: initialize rust project with axum

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Alexander
2026-04-28 18:05:27 +02:00
parent 98dcc63c9b
commit 7c55e5cddd
3 changed files with 1971 additions and 0 deletions
Generated
+1905
View File
File diff suppressed because it is too large Load Diff
+26
View File
@@ -0,0 +1,26 @@
[package]
name = "music-agregator"
version = "0.1.0"
edition = "2021"
[[bin]]
name = "music-agregator"
path = "src/main.rs"
[dependencies]
axum = "0.8"
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tower-http = { version = "0.6", features = ["cors", "trace"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
uuid = { version = "1", features = ["v4", "serde"] }
reqwest = { version = "0.12", default-features = false, features = ["json", "cookies", "rustls-tls", "multipart"] }
async-trait = "0.1"
thiserror = "2"
url = "2"
[profile.release]
opt-level = 3
lto = true
+40
View File
@@ -0,0 +1,40 @@
mod api;
mod models;
mod services;
mod torrent;
use std::sync::Arc;
use tokio::sync::RwLock;
use axum::Router;
use tower_http::cors::{Any, CorsLayer};
use tower_http::trace::TraceLayer;
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
use crate::services::Aggregator;
pub type AppState = Arc<RwLock<Aggregator>>;
#[tokio::main]
async fn main() {
tracing_subscriber::registry()
.with(tracing_subscriber::fmt::layer())
.with(tracing_subscriber::EnvFilter::from_default_env())
.init();
let state: AppState = Arc::new(RwLock::new(Aggregator::new()));
let cors = CorsLayer::new()
.allow_origin(Any)
.allow_methods(Any)
.allow_headers(Any);
let app = Router::new()
.nest("/api", api::routes(state))
.layer(cors)
.layer(TraceLayer::new_for_http());
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
tracing::info!("listening on {}", listener.local_addr().unwrap());
axum::serve(listener, app).await.unwrap();
}