Crates.io | actix-route-config |
lib.rs | actix-route-config |
version | 0.1.1 |
source | src |
created_at | 2023-05-17 20:07:53.103277 |
updated_at | 2023-05-17 20:11:31.150046 |
description | Allow clean configuration of Actix Web routes |
homepage | |
repository | https://github.com/TobiasDeBruijn/actix-route-config |
max_upload_size | |
id | 867189 |
size | 4,483 |
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.
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.
This project is licensed under:
At your option.