Files
tavernworks/bard/src/lib.rs
Myrddin Dundragon e6f3ff3c1e Setting bard to have a server mode.
This is so that the database using code that doesn't compile to WASM can
be used by the dioxus frontend.
2025-09-04 12:44:51 -04:00

22 lines
428 B
Rust

//! Dioxus components that will display a Tavern blogging system Blog.
mod info;
#[cfg(feature = "server")]
use tavern::Database;
pub use crate::info::{get_name, get_version};
#[cfg(feature = "server")]
pub async fn init_database<P>(path: P)
-> Result<std::sync::Arc<Database>, Box<dyn std::error::Error>>
where P: AsRef<std::path::Path>
{
let db = Database::open(path).await?;
Ok(std::sync::Arc::new(db))
}