working split configuration
This commit is contained in:
@@ -5,3 +5,6 @@ pub mod adresar;
|
||||
pub mod uctovnictvo;
|
||||
pub mod shared;
|
||||
pub mod table_structure;
|
||||
|
||||
// Re-export run_server from the inner server module:
|
||||
pub use server::run_server;
|
||||
|
||||
@@ -1,20 +1,24 @@
|
||||
// src/main.rs
|
||||
// server/src/main.rs
|
||||
use std::env;
|
||||
use dotenvy::dotenv;
|
||||
use crate::db;
|
||||
|
||||
// Import from the external library crate (named `server`)
|
||||
use server::run_server;
|
||||
use server::db;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
dotenv().ok();
|
||||
|
||||
// Initialize database
|
||||
// Initialize database using library module `db`
|
||||
let db_config = db::DatabaseConfig::from_env();
|
||||
let db_pool = db::create_pool(&db_config).await?;
|
||||
|
||||
match env::args().nth(1).as_deref() {
|
||||
Some("server") => server::run_server(db_pool).await?,
|
||||
Some("server") => run_server(db_pool).await?,
|
||||
_ => println!("Usage: cargo run -- [server|client]"),
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user