Allow clean configuration of actix-web routes.
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.
```rust use actixrouteconfig::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/fooending up at the
foo::foo` function.
This project is licensed under: - MIT - Apache 2.0
At your option.