fead(db): initialize database first
This commit is contained in:
parent
a379e93f44
commit
2bcdea79dc
1 changed files with 6 additions and 5 deletions
11
src/main.rs
11
src/main.rs
|
@ -18,15 +18,16 @@ async fn main() -> std::io::Result<()> {
|
|||
use std::sync::Arc;
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
|
||||
// Load configuration
|
||||
let conf = get_configuration(None).await.unwrap();
|
||||
let addr = conf.leptos_options.site_addr;
|
||||
|
||||
// Initialize the database
|
||||
let db = Database::new("compareware.db").unwrap();
|
||||
db.create_schema().await.unwrap(); // Ensure the schema is created
|
||||
let db = Arc::new(Mutex::new(db)); // Wrap the database in an Arc<Mutex<T>> for shared state
|
||||
println!("Schema created successfully!");
|
||||
|
||||
// Load configuration
|
||||
let conf = get_configuration(None).await.unwrap();
|
||||
let addr = conf.leptos_options.site_addr;
|
||||
|
||||
|
||||
// Generate the list of routes in your Leptos App
|
||||
let routes = generate_route_list(App);
|
||||
|
|
Loading…
Add table
Reference in a new issue