volga/lib.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
//! # Volga
//!
//! > 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.
//!
//! ## Features
//! * Supports HTTP/1 and HTTP/2
//! * Robust routing
//! * Custom middlewares
//! * Full [Tokio](https://tokio.rs/) compatibility
//! * Runs on stable Rust 1.80+
//!
//! ## Example
//! ```toml
//! [dependencies]
//! volga = "0.4.8"
//! tokio = { version = "1", features = ["full"] }
//! ```
//! ```no_run
//! 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
//! }
//! ```
#![forbid(unsafe_code)]
#![deny(unreachable_pub)]
mod server;
pub mod app;
pub mod http;
pub mod headers;
pub mod json;
#[cfg(feature = "di")]
pub mod di;
#[cfg(feature = "middleware")]
pub mod middleware;
#[cfg(feature = "tls")]
pub mod tls;
#[cfg(test)]
pub mod test_utils;
pub use crate::app::App;
pub use crate::http::{
response::builder::{RESPONSE_ERROR, SERVER_NAME},
endpoints::args::{
cancellation_token::CancellationToken,
file::File,
json::Json,
path::Path,
query::Query,
form::Form,
},
BoxBody,
UnsyncBoxBody,
HttpBody,
HttpRequest,
HttpResponse,
HttpResult,
HttpHeaders,
ResponseContext,
Results
};
#[cfg(feature = "multipart")]
pub use crate::http::endpoints::args::multipart::Multipart;
pub mod routing {
pub use crate::app::router::RouteGroup;
}