From 0972fa6eab8c9111311f082ba8abfdc6b4a40945 Mon Sep 17 00:00:00 2001 From: nil Date: Wed, 2 Oct 2024 17:48:56 +0200 Subject: commit changes --- rust/src/main.rs | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 rust/src/main.rs (limited to 'rust/src/main.rs') diff --git a/rust/src/main.rs b/rust/src/main.rs deleted file mode 100644 index af45779..0000000 --- a/rust/src/main.rs +++ /dev/null @@ -1,35 +0,0 @@ -mod structs; -mod routes; - -use actix_web::{web, App, HttpServer}; -use sqlx::mysql::{MySqlPool, MySqlPoolOptions}; - -#[derive(Clone)] -struct AppState { - pool: MySqlPool, -} - -#[actix_web::main] -async fn main() -> std::io::Result<()> { - let pool: MySqlPool = MySqlPoolOptions::new() - .max_connections(10) - .connect(DB_URL) - .await - .unwrap(); - - let app_state = AppState { pool }; - - HttpServer::new(move || { - App::new() - .app_data(web::Data::new(app_state.clone())) - .route("/", web::get().to(root)) - .service(routes::hello::hello_actix) - }) - .bind(("127.0.0.1", 8000))? - .run() - .await -} - -async fn root() -> String { - String::from("Server is up and running") -} -- cgit v1.2.3