diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/main.rs b/src/main.rs index 0bd3087..8a64e0d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,6 @@ +mod api; +mod auth; mod database; -mod routes; mod structs; use actix_web::{web, App, HttpServer}; @@ -9,6 +10,7 @@ use std::sync::Arc; #[derive(Clone)] struct AppState { database: Arc<database::DatabaseWrapper>, + secret: String, } #[actix_web::main] @@ -25,25 +27,17 @@ async fn main() -> std::io::Result<()> { }; let db = Arc::new(db_raw); - let app_state = AppState { database: db }; + let app_state = AppState { + database: db, + secret: "secret".to_owned(), + }; HttpServer::new(move || { App::new() .app_data(web::Data::new(app_state.clone())) .route("/", web::get().to(root)) - .service(routes::song::get_song) - .service(routes::song::post_song) - .service(routes::song::put_song) - .service(routes::song::delete_song) - .service(routes::album::get_album) - .service(routes::album::post_album) - .service(routes::album::put_album) - .service(routes::album::delete_album) - .service(routes::artist::get_artist) - .service(routes::artist::post_artist) - .service(routes::artist::put_artist) - .service(routes::artist::delete_artist) - .service(routes::search_results::search_results) + .service(api::api_scope()) + .service(auth::auth_scope()) }) .bind(("127.0.0.1", 8000))? .run() |