refactor(caesar): restructure the project to a monorepo

This commit is contained in:
Patryk Hegenberg 2024-05-05 13:42:11 +02:00
parent 17ebd0261b
commit b39e88107a
27 changed files with 195 additions and 142 deletions

18
caesar-shuttle/Cargo.toml Normal file
View file

@ -0,0 +1,18 @@
[package]
name = "caesar-transfer-iu"
version = "0.3.1"
edition = "2021"
authors = ["Manuel Keidel, Patryk Hegenberg, Krzysztof Stankiewicz"]
[[bin]]
name = "caesar-transfer-iu"
path = "src/main.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
caesar-core = { path = "../caesar-core" }
shuttle-axum = { version = "0.44.0" }
shuttle-runtime = { version = "0.44.0" }
axum = { version = "0.7.5", features = ["ws"] }
axum-client-ip = "0.6.0"

View file

@ -0,0 +1,28 @@
use axum::{
routing::{get, post, put},
Router,
};
use axum_client_ip::SecureClientIpSource;
use caesar_core::relay::appstate::AppState;
use caesar_core::relay::server::download_info;
use caesar_core::relay::server::download_success;
use caesar_core::relay::server::upload_info;
use caesar_core::relay::server::ws_handler;
use shuttle_axum::ShuttleAxum;
#[shuttle_runtime::main]
async fn axum() -> ShuttleAxum {
// Create a new server data structure.
let appstate = AppState::new();
// Set up the application routes.
let app = Router::new()
.route("/ws", get(ws_handler))
.route("/upload", put(upload_info))
.route("/download/:name", get(download_info))
.route("/download_success/:name", post(download_success))
.with_state(appstate)
.layer(SecureClientIpSource::ConnectInfo.into_extension());
Ok(app.into())
}