9 releases
Uses new Rust 2024
| new 0.2.8 | Oct 17, 2025 |
|---|---|
| 0.2.7 | Sep 5, 2025 |
| 0.2.6 | Aug 6, 2025 |
| 0.2.5 | Jun 12, 2025 |
| 0.1.2 |
|
#1261 in HTTP server
47KB
825 lines
caslex
caslex is a set of tools for creating web services.
More information about this crate can be found in the crate documentation.
High level features
- HTTP web server
- HTTP middlewares (auth, metrics, trace)
- Builtin OpenAPI visualizer
- Errors handling
- JWT
- Postgres Pool
- Observability
- Extra utils
Usage example
use caslex::server::{Config, Server};
use utoipa_axum::{router::OpenApiRouter, routes};
#[utoipa::path(
get,
path = "/",
responses(
(status = 200, description = "Ok")
)
)]
async fn handler() -> &'static str {
"Hello, World!"
}
#[tokio::main]
async fn main() {
let config = Config::parse();
let router = OpenApiRouter::new().routes(routes!(handler));
let result = Server::new(config).router(router).run().await;
match result {
Ok(_) => std::process::exit(0),
Err(_) => {
std::process::exit(1);
}
}
}
You can find this example as well as other example projects in the example directory.
See the crate documentation for way more examples.
Safety
This crate uses #![forbid(unsafe_code)] to ensure everything is implemented in 100% safe Rust.
Examples
The examples folder contains various examples of how to use axum. The docs also provide lots of code snippets and examples.
Projects
List of projects using caslex:
- rust-simple-chat: sample project.
License
This project is licensed under the MIT license.
Dependencies
~23–32MB
~560K SLoC