2 releases
0.1.1 | May 17, 2023 |
---|---|
0.1.0 | May 17, 2023 |
#120 in #routing
42 downloads per month
3KB
Actix-route-config
Allow clean configuration of actix-web routes.
Explanation
I like the concept of 'routers' to configure my Actix web servers.
This trait specifies a function configure
which can be called directly from Actix's configure method.
Example
use actix_route_config::Routable;
use actix_web::web;
pub struct Router;
impl Routable for Router {
fn configure(config: &mut ServiceConfig) {
config.service(web::scope("/api")
// Assuming there's a submodule `foo` with a handler function `foo`
.route("/foo", web::get().to(foo:foo))
);
}
}
This will create a route /api/foo
ending up at the foo::foo
function.
License
This project is licensed under:
At your option.
lib.rs
:
Allow clean configuration of Actix Web routes.
Dependencies
~15–26MB
~433K SLoC