caesar-transfer/src/shuttle.rs
Patryk Hegenberg 5eda6c4180 fix(caesar): start refactoring the codebase
For a more suitable Name the server struct was renamed to AppState.
2024-04-28 01:59:25 +02:00

23 lines
571 B
Rust

use axum::{routing::get, Router};
use axum_client_ip::SecureClientIpSource;
use relay::server;
use shuttle_axum::ShuttleAxum;
pub mod receiver;
pub mod relay;
pub mod sender;
pub mod shared;
#[shuttle_runtime::main]
async fn axum() -> ShuttleAxum {
// Create a new server data structure.
let appstate = server::AppState::new();
// Set up the application routes.
let app = Router::new()
.route("/ws", get(relay::ws_handler))
.with_state(appstate)
.layer(SecureClientIpSource::ConnectInfo.into_extension());
Ok(app.into())
}