diff options
Diffstat (limited to 'rust/src')
-rw-r--r-- | rust/src/main.rs | 35 | ||||
-rw-r--r-- | rust/src/routes.rs | 1 | ||||
-rw-r--r-- | rust/src/routes/hello.rs | 11 | ||||
-rw-r--r-- | rust/src/structs.rs | 35 |
4 files changed, 0 insertions, 82 deletions
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") -} diff --git a/rust/src/routes.rs b/rust/src/routes.rs deleted file mode 100644 index 8cb6ff0..0000000 --- a/rust/src/routes.rs +++ /dev/null @@ -1 +0,0 @@ -mod hello; diff --git a/rust/src/routes/hello.rs b/rust/src/routes/hello.rs deleted file mode 100644 index c356081..0000000 --- a/rust/src/routes/hello.rs +++ /dev/null @@ -1,11 +0,0 @@ -use crate::AppState; -use actix_web::{get, web, HttpResponse}; -use serde::Deserialize; - -#[get("/hello")] -pub async fn hello_actix(app_state: web::Data<AppState>) -> HttpResponse { - struct Song { - } - - return HttpResponse::Ok().json(databases); -} diff --git a/rust/src/structs.rs b/rust/src/structs.rs deleted file mode 100644 index 7535bb4..0000000 --- a/rust/src/structs.rs +++ /dev/null @@ -1,35 +0,0 @@ -#[allow(dead_code)] -struct Song { - //song variables - id: i32, - title: String, - lyrics: String, - - //album variables - album_id: i32, - genres: Vec<String>, - album_cover: String, - - //artist variables - artist_id: i32, - artist_name: String, -} - -#[allow(dead_code)] -struct Album { - id: i32, - title: String, - genres: Vec<String>, - cover: String, - songs: Vec<i32>, -} - -#[allow(dead_code)] -struct Artist { - id: i32, - name: String, - genres: Vec<String>, - albums: Vec<i32>, -} - -// lepht anonym |