pub struct Ultimo { /* private fields */ }Expand description
Main Ultimo application
Implementations§
Source§impl Ultimo
impl Ultimo
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new Ultimo application
By default, adds X-Powered-By: Ultimo header to all responses.
To disable this, use new_without_defaults() instead.
Sourcepub fn new_without_defaults() -> Self
pub fn new_without_defaults() -> Self
Create a new Ultimo application without default middleware
Use this if you don’t want the X-Powered-By: Ultimo header
or want full control over middleware configuration.
Sourcepub fn max_body_size(&mut self, bytes: usize) -> &mut Self
pub fn max_body_size(&mut self, bytes: usize) -> &mut Self
Set the maximum request body size in bytes.
Requests whose body exceeds this are rejected with 413 Payload Too Large (and, on the live server, the oversized body is not buffered). Defaults to no limit — setting one is recommended for production.
Sourcepub fn trust_proxy(&mut self, trust: bool) -> &mut Self
pub fn trust_proxy(&mut self, trust: bool) -> &mut Self
Trust X-Forwarded-For / Forwarded headers for Context::client_ip.
Only enable when the app sits behind a trusted proxy/load balancer —
these headers are client-spoofable, so trusting them on a directly-exposed
server lets clients forge their IP. Defaults to false.
Sourcepub fn get(
&mut self,
path: &str,
handler: impl IntoHandler + 'static,
) -> &mut Self
pub fn get( &mut self, path: &str, handler: impl IntoHandler + 'static, ) -> &mut Self
Add a GET route
Sourcepub fn post(
&mut self,
path: &str,
handler: impl IntoHandler + 'static,
) -> &mut Self
pub fn post( &mut self, path: &str, handler: impl IntoHandler + 'static, ) -> &mut Self
Add a POST route
Sourcepub fn put(
&mut self,
path: &str,
handler: impl IntoHandler + 'static,
) -> &mut Self
pub fn put( &mut self, path: &str, handler: impl IntoHandler + 'static, ) -> &mut Self
Add a PUT route
Sourcepub fn delete(
&mut self,
path: &str,
handler: impl IntoHandler + 'static,
) -> &mut Self
pub fn delete( &mut self, path: &str, handler: impl IntoHandler + 'static, ) -> &mut Self
Add a DELETE route
Sourcepub fn patch(
&mut self,
path: &str,
handler: impl IntoHandler + 'static,
) -> &mut Self
pub fn patch( &mut self, path: &str, handler: impl IntoHandler + 'static, ) -> &mut Self
Add a PATCH route
Sourcepub fn options(
&mut self,
path: &str,
handler: impl IntoHandler + 'static,
) -> &mut Self
pub fn options( &mut self, path: &str, handler: impl IntoHandler + 'static, ) -> &mut Self
Add an OPTIONS route
Sourcepub fn use_middleware(&mut self, middleware: BoxedMiddleware) -> &mut Self
pub fn use_middleware(&mut self, middleware: BoxedMiddleware) -> &mut Self
Add global middleware