diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/api/mod.rs | 1 | ||||
-rw-r--r-- | src/auth.rs | 2 | ||||
-rw-r--r-- | src/main.rs | 13 |
3 files changed, 8 insertions, 8 deletions
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<String, HttpResponse }; } -// todo! tell if the user has been deleted or not #[delete("/user")] pub async fn delete_user( app_state: web::Data<AppState>, 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") } |