pub fn config(c: impl Fn(&mut Config) + Send + Sync + 'static) -> Self {
        let mut config = Config::new();

        c(&mut config);

        #[allow(unused_mut)]
        let mut state = State::new();

        #[cfg(feature = "html")]
        state.set(match Tera::parse(&format!("{}/**/*", config.template_path)) {
            Ok(t) => t,
            Err(e) => {
                println!("Parsing error(s): {}", e);
                ::std::process::exit(1);
            }
        });

        Self {
            config: Arc::new(config),
            state: Arc::new(state),
            middle: Arc::new(IndexMap::new()),
            routes: Arc::new(Router::default()),
        }
    }
/// Set the configuration of the server.
///
/// This is an alternative to `Direkuta::new()` and allows you to set custom paths.
///
/// # Examples
///
/// ```rust
/// # use direkuta::prelude::*;
/// Direkuta::config(|c| {
///     c.template_path("html/templates");
/// });
/// ```
Set the configuration of the server.
This is an alternative to `Direkuta::new()` and allows you to set custom paths.
Set the configuration of the server . This is an alternative to ` Direkuta :: new () ` and allows you to set custom paths .
pub fn config(c: impl Fn(&mut Config) + Send + Sync + 'static) -> Self {
        let mut config = Config::new();
        c(&mut config);
        #[allow(unused_mut)]
        let mut state = State::new();
        #[cfg(feature = "html")]
        state.set(match Tera::parse(&format!("{}/**/*", config.template_path)) {
            Ok(t) => t,
            Err(e) => {
                println!("Parsing error(s): {}", e);
                ::std::process::exit(1);
            }
        });
        Self {
            config: Arc::new(config),
            state: Arc::new(state),
            middle: Arc::new(IndexMap::new()),
            routes: Arc::new(Router::default()),
        }
    }
pub fn config ( c : impl Fn ( & mut Config ) + Send + Sync + ' static ) -> Self { let mut config = Config :: new ( ) ; c ( & mut config ) ; # [ allow ( unused_mut ) ] let mut state = State :: new ( ) ; # [ cfg ( feature " " ) ] state . set ( match Tera :: parse ( & format ! ( " " config template_path ) ) { Ok ( t ) => t , Err ( e ) => { println ! ( " " e ) ; :: std :: process :: exit ( 1 ) ; } } ) ; Self { config : Arc :: new ( config ) , state : Arc :: new ( state ) , middle : Arc :: new ( IndexMap :: new ( ) ) , routes : Arc :: new ( Router :: default ( ) ) , } }
Set the configuration of the server.
Set the configuration of the server .
c
impl Fn(&mut Config) + Send + Sync + 'static
c
impl Fn(&mut Config) + Send + Sync + 'static
examples
None
use direkuta::prelude::*;
None