bws_web_server/
lib.rs

1//! BWS (Blazing Web Server) - A high-performance multi-site web server
2//!
3//! BWS is built with the Pingora framework and provides enterprise-grade
4//! features including SSL/TLS management, load balancing, and security.
5
6pub mod config;
7pub mod core;
8pub mod handlers;
9pub mod middleware;
10pub mod monitoring;
11pub mod server;
12pub mod ssl;
13
14// Re-export main types for convenience
15pub use config::{ServerConfig, SiteConfig};
16pub use core::{BwsError, BwsResult};
17pub use monitoring::{CertificateWatcher, HealthHandler};
18pub use server::WebServerService;
19pub use ssl::{AcmeConfig, SslManager};
20
21// Legacy compatibility exports for external crates
22use std::fs;
23
24/// Read file contents as bytes
25///
26/// # Errors
27///
28/// Returns an IO error if the file cannot be read.
29pub fn read_file_bytes(file_path: &str) -> std::io::Result<Vec<u8>> {
30    fs::read(file_path)
31}
32
33/// Get MIME type for a file extension
34///
35/// # Arguments
36///
37/// * `file_path` - The file path to determine MIME type for
38///
39/// # Returns
40///
41/// Returns the MIME type string for the file extension
42#[must_use]
43pub fn get_mime_type(file_path: &str) -> &'static str {
44    // Use the new utils module for MIME type detection
45    let path = std::path::Path::new(file_path);
46    let extension = path.extension().and_then(|ext| ext.to_str()).unwrap_or("");
47
48    core::utils::fs::get_mime_type(extension)
49}