Skip to main content

ApiGatewayCapability

Trait ApiGatewayCapability 

Source
pub trait ApiGatewayCapability:
    Send
    + Sync
    + 'static {
    // Required methods
    fn rest_prepare(&self, ctx: &ModuleCtx, router: Router) -> Result<Router>;
    fn rest_finalize(&self, ctx: &ModuleCtx, router: Router) -> Result<Router>;
    fn as_registry(&self) -> &dyn OpenApiRegistry;
}
Expand description

API Gateway capability: handles gateway hosting with prepare/finalize phases. Must be sync. Runs during REST phase, but doesn’t start the server.

Required Methods§

Source

fn rest_prepare(&self, ctx: &ModuleCtx, router: Router) -> Result<Router>

Prepare a base Router (e.g., global middlewares, /healthz) and optionally touch OpenAPI meta. Do NOT start the server here.

§Errors

Returns an error if router preparation fails.

Source

fn rest_finalize(&self, ctx: &ModuleCtx, router: Router) -> Result<Router>

Finalize before start: attach /openapi.json, /docs, persist the Router internally if needed. Do NOT start the server here.

§Errors

Returns an error if router finalization fails.

Source

fn as_registry(&self) -> &dyn OpenApiRegistry

Implementors§