Crate volga

Source
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.0"
tokio = "1.41.1"
use volga::*;
 
#[tokio::main]
async fn main() -> std::io::Result<()> {
    // Start the server
    let mut app = App::new();
 
    // Example of asynchronous 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§

  • Produces OK 200 response with file body
  • Creates HTTP Request/Response headers
  • Produces an OK 200 response with plain text or JSON body
  • Produces a response with specified StatusCode with plain text or JSON body