Expand description
§Volga
Fast, Easy, and very flexible Web Framework for Rust based on Tokio runtime and hyper for fun and painless microservices crafting.
§Features
- Supports HTTP/1 and HTTP/2
- Robust routing
- Custom middlewares
- Full Tokio compatibility
- Runs on stable Rust 1.80+
§Example
[dependencies]
volga = "0.4.2"
tokio = { version = "1", features = ["full"] }use volga::*;
#[tokio::main]
async fn main() -> std::io::Result<()> {
// Start the server
let mut app = App::new();
// Example of request handler
app.map_get("/hello/{name}", |name: String| async move {
ok!("Hello {name}!")
});
app.run().await
}Re-exports§
pub use crate::app::App;pub use crate::app::router::Router;pub use crate::app::body::BoxBody;pub use crate::app::body::HttpBody;pub use crate::app::results::HttpResponse;pub use crate::app::results::HttpResult;pub use crate::app::results::HttpHeaders;pub use crate::app::results::Results;pub use crate::app::results::ResponseContext;pub use crate::app::request::HttpRequest;pub use crate::app::endpoints::args::path::Path;pub use crate::app::endpoints::args::json::Json;pub use crate::app::endpoints::args::file::File;pub use crate::app::endpoints::args::query::Query;pub use crate::app::endpoints::args::headers;pub use crate::app::endpoints::args::cancellation_token::CancellationToken;pub use crate::app::http_context::HttpContext;pub use crate::app::middlewares::Next;pub use crate::app::middlewares::Middleware;
Modules§
Macros§
- Declares a custom HTTP headers
- Produces
OK 200response with file body - Creates HTTP Request/Response headers
- Produces an
OK 200response with plain text or JSON body - Produces a response with specified
StatusCodewith plain text or JSON body
Structs§
- An HTTP status code (
status-codein RFC 9110 et al.).