pub fn new(config: HttpConfig) -> Self {
		let mut cloned_config = config.clone();
		let home_dir = match dirs::home_dir() {
			Some(p) => p,
			None => PathBuf::new(),
		}
		.as_path()
		.display()
		.to_string();
		cloned_config.root_dir = config.root_dir.replace("~", &home_dir);

		let exists = match std::fs::metadata(cloned_config.root_dir.clone()) {
			Ok(md) => md.is_dir(),
			Err(_) => false,
		};

		if !exists {
			match Self::build_webroot(cloned_config.root_dir.clone()) {
				Ok(_) => {}
				Err(e) => {
					log_multi!(
						ERROR,
						MAIN_LOG,
						"building webroot generated error: {}",
						e.to_string()
					);
				}
			}
		}

		HttpServer {
			config: cloned_config,
			listener: None,
			http_context: None,
		}
	}
/// Create a new HttpServer instance based on the [`HttpConfig`]
/// specified.
Create a new HttpServer instance based on the [`HttpConfig`]
specified.
Create a new HttpServer instance based on the [ ` HttpConfig ` ] specified .
pub fn new(config: HttpConfig) -> Self {
		let mut cloned_config = config.clone();
		let home_dir = match dirs::home_dir() {
			Some(p) => p,
			None => PathBuf::new(),
		}
		.as_path()
		.display()
		.to_string();
		cloned_config.root_dir = config.root_dir.replace("~", &home_dir);
		let exists = match std::fs::metadata(cloned_config.root_dir.clone()) {
			Ok(md) => md.is_dir(),
			Err(_) => false,
		};
		if !exists {
			match Self::build_webroot(cloned_config.root_dir.clone()) {
				Ok(_) => {}
				Err(e) => {
					log_multi!(
						ERROR,
						MAIN_LOG,
						"building webroot generated error: {}",
						e.to_string()
					);
				}
			}
		}
		HttpServer {
			config: cloned_config,
			listener: None,
			http_context: None,
		}
	}
pub fn new ( config : HttpConfig ) -> Self { let mut cloned_config = config . clone ( ) ; let home_dir = match dirs :: home_dir ( ) { Some ( p ) => p , None => PathBuf :: new ( ) , } . as_path ( ) . display ( ) . to_string ( ) ; cloned_config . root_dir = config . root_dir . replace ( " " , & home_dir ) ; let exists = match std :: fs :: metadata ( cloned_config . root_dir . clone ( ) ) { Ok ( md ) => md . is_dir ( ) , Err ( _ ) => false , } ; if ! exists { match Self :: build_webroot ( cloned_config . root_dir . clone ( ) ) { Ok ( _ ) => { } Err ( e ) => { log_multi ! ( ERROR MAIN_LOG " " e to_string ( ) ) ; } } } HttpServer { config : cloned_config , listener : None , http_context : None , } }
Create a new HttpServer instance based on the [`HttpConfig`]
specified.
Create a new HttpServer instance based on the [ ` HttpConfig ` ] specified .
config
HttpConfig
config
HttpConfig