summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index f55a17c..0bd3087 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -19,9 +19,11 @@ async fn main() -> std::io::Result<()> {
env_logger::init();
dotenv().ok();
- let db_raw = database::DatabaseWrapper::new()
- .await
- .expect("Something went wrong while creating DatabaseWrapper");
+ let db_raw = match database::DatabaseWrapper::new().await {
+ Ok(res) => res,
+ Err(_) => panic!("Error creating database wrapper"),
+ };
+
let db = Arc::new(db_raw);
let app_state = AppState { database: db };
@@ -30,9 +32,17 @@ async fn main() -> std::io::Result<()> {
.app_data(web::Data::new(app_state.clone()))
.route("/", web::get().to(root))
.service(routes::song::get_song)
- .service(routes::album::album)
+ .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)
})
.bind(("127.0.0.1", 8000))?