| Crates.io | htmstd |
| lib.rs | htmstd |
| version | 0.7.0 |
| created_at | 2025-11-21 15:43:52.908525+00 |
| updated_at | 2025-11-21 15:43:52.908525+00 |
| description | Standard Middleware Library for Starberry |
| homepage | |
| repository | https://github.com/Field-of-Dreams-Studio/hotaru |
| max_upload_size | |
| id | 1943735 |
| size | 75,309 |
Standard middleware collection for the Hotaru web framework, providing common functionality like CORS, sessions, and authentication.
Configure CORS policies for your application:
use htmstd::cors::AppCorsSettings;
let app = App::new()
.set_config(
AppCorsSettings::new()
.allow_origin("https://example.com")
.allow_methods(vec!["GET", "POST"])
)
.build();
Secure session management using encrypted cookies:
use htmstd::session::CookieSession;
let app = App::new()
.append_middleware::<CookieSession>()
.build();
Access session data in handlers:
endpoint! {
APP.url("/login"),
pub login<HTTP> {
let mut session = ctx.get_session();
session.set("user_id", "12345");
text_response("Logged in")
}
}
Configure HTTP safety limits per endpoint or globally:
use hotaru_core::http::HttpSafety;
use hotaru_core::http::HttpMethod;
endpoint! {
APP.url("/api/upload"),
config=[HttpSafety::new()
.with_max_body_size(50 * 1024 * 1024) // 50MB
.with_allowed_methods(vec![HttpMethod::POST])
],
pub upload<HTTP> {
// Handle file upload
}
}
For complete examples, see:
MIT License
This is the standard middleware library for the Hotaru web framework.
Learn more: https://fds.rs