pub mod error;
pub mod types;
pub mod handler;
pub mod executor;
pub mod runtime;
pub mod integration;
#[cfg(feature = "wasm")]
pub mod wasm;
#[cfg(feature = "websocket")]
pub mod websocket;
#[cfg(feature = "cli")]
pub mod cli;
#[cfg(feature = "web")]
pub mod web;
#[cfg(feature = "templates")]
pub mod templates;
#[cfg(feature = "database")]
pub mod database;
#[cfg(feature = "auth")]
pub mod auth;
#[cfg(feature = "dev_server")]
pub mod dev_server;
pub use error::{HandlerError, Result};
pub use types::*;
pub use handler::UnifiedHandler;
pub use executor::HandlerExecutor;
pub use kotoba_storage::KeyValueStore;
pub use std::sync::Arc;
#[cfg(feature = "wasm")]
pub fn init_wasm_handler() -> Result<wasm::WasmHandler> {
wasm::WasmHandler::new()
}
#[cfg(feature = "cli")]
pub async fn execute_cli_handler(file: &str, args: Vec<String>) -> Result<String> {
cli::execute_handler(file, args).await
}
pub async fn execute_simple_handler_with_storage<T: KeyValueStore + 'static>(
storage: Arc<T>,
content: &str,
context: HandlerContext,
) -> Result<String> {
let handler = UnifiedHandler::new(storage);
handler.execute(content, context).await
}
#[cfg(feature = "web")]
pub async fn run_web_app(addr: &str, config: web::WebConfig) -> Result<()> {
web::run_web_app(addr, config).await
}
#[cfg(feature = "dev_server")]
pub async fn run_dev_server(addr: &str, config: dev_server::DevServerConfig) -> Result<()> {
dev_server::run_dev_server(addr, config).await
}
#[cfg(feature = "database")]
pub async fn init_database(url: &str) -> Result<database::DatabaseConnection> {
database::init_connection(url).await
}
#[cfg(feature = "auth")]
pub fn create_auth_middleware(config: auth::AuthConfig) -> auth::AuthMiddleware {
auth::AuthMiddleware::new(config)
}
#[cfg(feature = "templates")]
pub fn init_template_engine(template_dir: &str) -> Result<templates::TemplateEngine> {
templates::TemplateEngine::new(template_dir)
}