From 5891af7e8c1411029fe1ad9c6d3182f88bcf3dfd Mon Sep 17 00:00:00 2001 From: niliara-edu Date: Sun, 26 Jan 2025 12:55:13 +0100 Subject: comment and update information --- src/api/mod.rs | 1 + src/auth.rs | 2 +- src/main.rs | 13 ++++++------- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/api/mod.rs b/src/api/mod.rs index d07079a..2a7c3a8 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -6,6 +6,7 @@ pub mod artist; pub mod search_results; pub mod song; +/* Set up scope */ pub fn api_scope() -> Scope { web::scope("/api") .service(song::get_song) diff --git a/src/auth.rs b/src/auth.rs index 5fdf079..9c6f978 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -5,6 +5,7 @@ use chrono::{Duration, Utc}; use jsonwebtoken::{encode, EncodingKey, Header}; use serde::{Deserialize, Serialize}; +/* Set up scope */ pub fn auth_scope() -> Scope { web::scope("/auth") .service(register) @@ -112,7 +113,6 @@ async fn encode_token(id: usize, secret: &String) -> Result, diff --git a/src/main.rs b/src/main.rs index 941df3a..69eed5d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,25 +24,24 @@ struct AppState { #[actix_web::main] async fn main() -> std::io::Result<()> { - // Errors can get very tough, - // the rust log saved my ass + /* Enable the log */ std::env::set_var("RUST_LOG", "debug"); env_logger::init(); dotenv().ok(); - /* create database wrapper (reference: acsim) */ + /* Create database wrapper (reference: acsim) */ let db_raw = match database::DatabaseWrapper::new().await { Ok(res) => res, Err(_) => panic!("Error creating database wrapper"), }; let db = Arc::new(db_raw); - /* get jwt secret from env */ + /* Get jwt secret from env */ let jwt_secret = env::var("SECRET") .expect("environment variable SECRET is *probably not setted up!!") .to_string(); - /* application data struct */ + /* Application data struct */ let app_state = AppState { database: db, secret: jwt_secret, @@ -80,7 +79,7 @@ async fn main() -> std::io::Result<()> { // let openapi = ApiDoc::openapi(); - /* main server setup */ + /* Server setup */ HttpServer::new(move || { App::new() .app_data(web::Data::new(app_state.clone())) @@ -97,7 +96,7 @@ async fn main() -> std::io::Result<()> { .await } -/* main page*/ +/* Main page*/ async fn root() -> String { String::from("Server is up and running") } -- cgit v1.2.3