Struct susanoo::Susanoo
[−]
[src]
pub struct Susanoo { /* fields omitted */ }
Root instance of Web application.
Methods
impl Susanoo
[src]
fn with_route(self, route: Route) -> Self
Add a route to the application.
fn with_middleware<M: Middleware>(self, middleware: M) -> Self
Add a middleware to the application.
If you want to apply middelewares to certain route, use Route::with_middleware
.
fn bind<S: Into<SocketAddr>>(self, addr: S) -> Self
Set listen address of the application.
The default address is "0.0.0.0:4000"
.
fn threads(self, num: usize) -> Self
Set the number of threads running simulateneous event loops (Unix only).
The default value is 1.
fn run(self)
Start the server with given configuration.
This method will block the current thread until the server is shut down.