pub struct HttpRouteConfig {
pub path: String,
pub methods: Vec<HttpMethod>,
pub subdomain: String,
pub middleware: Vec<String>,
pub metrics: bool,
pub response_type: RouteResponseType,
}Expand description
Configuration for an HTTP route to register with the gateway
Fields§
§path: StringPath prefix for routing (e.g., “/api/users”)
methods: Vec<HttpMethod>HTTP methods (empty = all methods)
subdomain: StringSubdomain pattern: “” (default, bare domain), “any”, “exact:domain”, “prefix:x-”, “suffix:.x”
middleware: Vec<String>Middleware names to apply (resolved from gateway config definitions)
metrics: boolIf true, this route is a metrics endpoint (registered for Prometheus discovery, not public routing)
response_type: RouteResponseTypeError response format for this route (default: JSON)
Implementations§
Source§impl HttpRouteConfig
impl HttpRouteConfig
Sourcepub fn new(path: impl Into<String>) -> Self
pub fn new(path: impl Into<String>) -> Self
Create a new route config for the given path (all methods, bare domain)
Sourcepub fn with_methods(self, methods: Vec<HttpMethod>) -> Self
pub fn with_methods(self, methods: Vec<HttpMethod>) -> Self
Restrict to specific HTTP methods
Sourcepub fn with_subdomain(self, subdomain: impl Into<String>) -> Self
pub fn with_subdomain(self, subdomain: impl Into<String>) -> Self
Set subdomain pattern
Sourcepub fn with_middleware(self, middleware: Vec<String>) -> Self
pub fn with_middleware(self, middleware: Vec<String>) -> Self
Set middleware names to apply to this route
Sourcepub fn as_metrics(self) -> Self
pub fn as_metrics(self) -> Self
Mark this route as a metrics endpoint for Prometheus discovery
Trait Implementations§
Source§impl Clone for HttpRouteConfig
impl Clone for HttpRouteConfig
Source§fn clone(&self) -> HttpRouteConfig
fn clone(&self) -> HttpRouteConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HttpRouteConfig
impl RefUnwindSafe for HttpRouteConfig
impl Send for HttpRouteConfig
impl Sync for HttpRouteConfig
impl Unpin for HttpRouteConfig
impl UnsafeUnpin for HttpRouteConfig
impl UnwindSafe for HttpRouteConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more