# lest This crate provides a modular abstraction over `actix-web` allowing advanced guarding, request/response verification and separate modules. The concepts are designed to be similar to NestJS and ElysiaJS in terms of modularity and request/response verification. It's designed to be easy, and uses my other library `libcoerced` to provide advanced verification. ## Example ### Basic Usage This provides a root route and serves a directory excluding the path `routes/**`. ```rust use lest::{models::{guard::Guard, app::App, request::Request, response::{Response, Status}, route::{Route, RouteResponse}, served::Served}, types::method::Method, leaked}; fn route_handler(_req: Request) -> RouteResponse { Box::pin(async { let mut response = Response::new(Status::from_u16(302)); response.redirect("/index.html".to_string()); Ok(response) }) } let root_route = Route::new( Method::Get, // Require GET method route_handler, /// Route handler None, // NO request verification None, // NO response verification Guard::Combine(Box::from([ Guard::Host("localhost"), Guard::Port(8080), ])) // Enforce host and port ); let mut app = App::new(("/".to_string(), Some(root_route))); app.dir(Served { root: "/".to_string(), path: "static".to_string(), index_html: true, }, Box::from([ "routes/**", ])); leaked(app) .serve( 8080, Box::pin(async { println!("Server started at http://localhost:8080"); }) ).await; ``` ## Features Lest is designed to have everything you need out of the box- no middlewares, no extra dependencies. - **Guarding**: Enforce host, port, methods, headers, query parameters and more. - **Request/Response Verification**: Verify request and response bodies. - **Modular**: Separates different routes into different modules. - **Easy**: Designed to be easy to use and understand. - **Rewrites**: Rewrite request paths to different paths. - **Serving**: Serve directories and files and exclude restricted paths. - \[soon\] **Caching**: Cache responses and requests. - \[soon\] **Custom Errors**: Custom error handling. - \[soon\] **Rate Limiting**: Rate limit requests.