2 releases
Uses new Rust 2024
new 0.2.1 | Mar 31, 2025 |
---|---|
0.2.0 | Mar 30, 2025 |
0.1.2 |
|
0.1.1 |
|
0.1.0 |
|
#516 in HTTP server
137 downloads per month
47KB
822 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
~21–34MB
~540K SLoC