Skip to main content

Module serve

Module serve 

Source
Expand description

serve 命令 — 启动 HTTP 服务(可选加载 admin 插件)

对齐 PHP php think run,封装 sz_rust_core::server::serve_with_graceful_shutdown。

§用法

# 基础服务(不加载 admin 插件)
sz-rust serve

# 加载 admin 插件
sz-rust serve --with-admin --addr 0.0.0.0:8080

# 生产级配置
sz-rust serve --with-admin --workers 4 --grace-timeout 30 --health --access-log

Structs§

ServeArgs
serve 命令参数集合

Functions§

build_router_with_admin
构建 admin 插件路由并注册 Capability
build_router_with_data_scope
构建 data_scope_middleware 路由层
build_router_with_tenant
构建 tenant_middleware 路由层
build_runtime
构建 multi-thread tokio runtime
execute
执行 serve 命令(同步入口)
resolve_workers
解析有效 worker 数
validate_workers
校验 worker 数量合法性