base
ModuleWhat every server keeps: its mode, the hooks it runs around its work, its container, and how it resolves a hook's params.
Contents
use utopia_servers::Base;Rust
pub struct BaseThe state a Utopia-style server keeps: its mode, its init, shutdown and
error hooks (in every group, *), its start and end hooks, and its
container. Base::prepare resolves and validates a hook's params.
Rust
use utopia_servers::{Base, MODE_TYPE_PRODUCTION};
let mut base = Base::new();
base.set_mode(MODE_TYPE_PRODUCTION);
assert!(base.is_production());
base.init().desc("before every action");
assert_eq!(base.init_hooks()[0].get_groups(), ["*"]);Rust
pub const MODE_TYPE_DEVELOPMENT: &str = "development"The development mode.
Rust
pub const MODE_TYPE_PRODUCTION: &str = "production"The production mode.
Rust
pub const MODE_TYPE_STAGE: &str = "stage"The staging mode.