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
- Dependency Injection
- WebSockets and WebSocket-over-HTTP/2
- Full Tokio compatibility
- Runs on stable Rust 1.80+
§Example
use volga::*;
#[tokio::main]
async fn main() -> std::io::Result<()> {
// Start the server
let mut app = App::new();
// Example of a request handler
app.map_get("/hello/{name}", async |name: String| {
ok!("Hello {name}!")
});
app.run().await
}Re-exports§
pub use crate::app::App;pub use crate::http::response::builder::RESPONSE_ERROR;pub use crate::http::response::builder::SERVER_NAME;pub use crate::http::endpoints::args::cancellation_token::CancellationToken;pub use crate::http::endpoints::args::file::File;pub use crate::http::endpoints::args::json::Json;pub use crate::http::endpoints::args::path::Path;pub use crate::http::endpoints::args::path::NamedPath;pub use crate::http::endpoints::args::query::Query;pub use crate::http::endpoints::args::form::Form;pub use crate::http::endpoints::args::client_ip::ClientIp;pub use crate::http::endpoints::args::byte_stream::ByteStream;pub use crate::http::BoxBody;pub use crate::http::UnsyncBoxBody;pub use crate::http::HttpBody;pub use crate::http::HttpRequest;pub use crate::http::HttpResponse;pub use crate::http::HttpResult;pub use http::HttpRequestMut;pub use limits::Limit;pub use crate::http::endpoints::args::multipart::Multipart;
Modules§
- app
- Main application entry point
- auth
- Tools and utils for Authorization & Authentication
- di
- Tools for Dependency Injection
- error
- Error Handling tools
- fs
- File System tools and abstractions
- headers
- Tools for HTTP headers
- http
- Base HTTP tools
- json
- Tools for JSON format
- limits
- Resource limits and backpressure configuration.
- middleware
- Middleware tools
- openapi
- OpenAPI registry and configuration.
- rate_
limiting - Tools and utilities for Rate Limiting
- routing
- Route mapping helpers
- test
- Test utilities for building and running Volga applications in integration tests.
- tls
- HTTPS/TLS protocol implementations and middlewares
- tracing
- Tools for tracing, logging and observability
- utils
- Utilities and reusable helpers
- ws
- WebSockets and WebSocket-over-HTTP/2 protocol implementation and tools
Macros§
- accepted
- Produces HTTP 202 ACCEPTED response
- bad_
request - Produces HTTP 400 BAD REQUEST response
- builder
- Creates a default HTTP response builder
- byte_
stream - Creates an asynchronous stream
- claims
- Declares a structure as JWT claims and implements
AuthClaimstrait - created
- Produces HTTP 201 CREATED response
- file
- Produces
OK 200response with file body - form
- Produces
OK 200response with Form Data body - found
- Produces HTTP 302 FOUND response
- headers
- Declares a custom HTTP headers structure
- html
- Produces
OK 200response with HTML body - html_
file - Produces
OK 200response with HTML file body - no_
content - Produces
NO CONTENT 204response - not_
found - Produces HTTP 404 NOT FOUND response
- ok
- Creates a
200 OKresponse. - permanent_
redirect - Produces HTTP 308 PERMANENT REDIRECT response
- problem
Deprecated - Produces an error response in the Problem Details format
- redirect
- Produces HTTP 301 MOVED PERMANENTLY response
- response
- Creates an HTTP response with
status,bodyandheaders - see_
other - Produces HTTP 303 SEE OTHER response
- sse
- Produces
OK 200response with SSE (Server-Sent Events) stream body - sse_
stream - Creates an asynchronous SSE stream
- status
- Produces a response with the specified HTTP status code.
- stream
- Produces
OK 200response with stream body - temp_
redirect - Produces HTTP 307 TEMPORARY REDIRECT response