rig_onchain_kit/http/
server.rs1use actix_cors::Cors;
2use actix_web::middleware::{Compress, Logger};
3use actix_web::{web, App, HttpServer};
4use privy::Privy;
5
6use super::routes::{auth, healthz, stream};
7use super::state::AppState;
8
9pub async fn run_server(privy: Privy) -> std::io::Result<()> {
10 let state = web::Data::new(AppState::new(privy));
11
12 HttpServer::new(move || {
13 App::new()
14 .wrap(Logger::default())
15 .wrap(Compress::default())
16 .wrap(Cors::permissive())
17 .app_data(state.clone())
18 .service(healthz)
19 .service(stream)
20 .service(auth)
21 })
22 .bind("0.0.0.0:6969")?
23 .run()
24 .await
25}