Skip to main content

volga/
lib.rs

1//! # Volga
2//!
3//! > Fast, Easy, and very flexible Web Framework for Rust based on [Tokio](https://tokio.rs/) runtime and [hyper](https://hyper.rs/) for fun and painless microservices crafting.
4//!
5//! ## Features
6//! * Supports HTTP/1 and HTTP/2
7//! * Robust routing
8//! * Custom middlewares
9//! * Dependency Injection
10//! * WebSockets and WebSocket-over-HTTP/2
11//! * Full [Tokio](https://tokio.rs/) compatibility
12//! * Runs on stable Rust 1.80+
13//!
14//! ## Example
15//! ```no_run
16//! use volga::*;
17//!
18//! #[tokio::main]
19//! async fn main() -> std::io::Result<()> {
20//!     // Start the server
21//!     let mut app = App::new();
22//!
23//!     // Example of a request handler
24//!     app.map_get("/hello/{name}", async |name: String| {
25//!          ok!("Hello {name}!")
26//!     });
27//!     
28//!     app.run().await
29//! }
30//! ```
31
32mod server;
33
34pub mod app;
35#[cfg(any(feature = "basic-auth", feature = "jwt-auth"))]
36pub mod auth;
37#[cfg(feature = "config")]
38pub mod config;
39
40#[cfg(feature = "config")]
41pub use config::{Config, ConfigBuilder};
42
43#[cfg(feature = "di")]
44pub mod di;
45pub mod error;
46pub mod fs;
47#[cfg(feature = "__fuzzing")]
48#[doc(hidden)]
49pub mod fuzzing;
50pub mod headers;
51pub mod http;
52pub mod json;
53pub mod limits;
54#[cfg(feature = "middleware")]
55pub mod middleware;
56#[cfg(feature = "openapi")]
57pub mod openapi;
58#[cfg(feature = "rate-limiting")]
59pub mod rate_limiting;
60#[cfg(any(test, feature = "test"))]
61pub mod test;
62#[cfg(feature = "tls")]
63pub mod tls;
64#[cfg(feature = "tracing")]
65pub mod tracing;
66pub mod utils;
67#[cfg(feature = "ws")]
68pub mod ws;
69
70pub use crate::app::App;
71pub use crate::http::{
72    BoxBody, HttpBody, HttpRequest, HttpResponse, HttpResult, UnsyncBoxBody,
73    endpoints::args::{
74        byte_stream::ByteStream,
75        cancellation_token::CancellationToken,
76        client_ip::ClientIp,
77        file::File,
78        form::Form,
79        json::Json,
80        path::{NamedPath, Path},
81        query::Query,
82    },
83    response::builder::{RESPONSE_ERROR, SERVER_NAME},
84};
85
86#[cfg(feature = "middleware")]
87pub use http::HttpRequestMut;
88
89pub use limits::Limit;
90
91#[cfg(feature = "multipart")]
92pub use crate::http::endpoints::args::multipart::Multipart;
93
94/// Route mapping helpers
95pub mod routing {
96    pub use crate::app::router::{Route, RouteGroup};
97}
98
99#[doc(hidden)]
100pub use async_stream as __async_stream;