19 lines
507 B
Rust
19 lines
507 B
Rust
pub mod announce;
|
|
pub mod files;
|
|
pub mod health;
|
|
|
|
use axum::{routing::{get, post}, Router};
|
|
use tower_http::cors::CorsLayer;
|
|
use crate::state::SharedState;
|
|
|
|
pub fn router(state: SharedState) -> Router {
|
|
let api = Router::new()
|
|
.route("/health", get(health::health))
|
|
.route("/files/{file_id}", get(files::get_file))
|
|
.route("/announce", post(announce::announce))
|
|
.with_state(state);
|
|
|
|
Router::new()
|
|
.nest("/api/v1", api)
|
|
.layer(CorsLayer::permissive())
|
|
} |