Skip to main content

Crate foxtive_axum

Crate foxtive_axum 

Source
Expand description

§Foxtive Axum

A Rust web framework built on top of Axum providing standardized response formats, error handling, custom extractors, and utilities for building REST APIs.

§Quick Start

use axum::routing::get;
use axum::Router;
use foxtive::results::AppResult;
use foxtive::setup::trace::Tracing;
use foxtive_axum::http::response::ext::StructResponseExt;
use foxtive_axum::http::HttpResult;
use foxtive_axum::server::Server;
use std::sync::Arc;
use foxtive::App;

#[tokio::main]
async fn main() -> AppResult<()> {
    let app = App::builder("MyApp", "MYAPP")
        .build()
        .await?;

    let router = Router::new().route("/", get(handler));

    Server::new(app)
        .host("127.0.0.1")
        .port(3000)
        .router(router)
        .tracing(Tracing::default())
        .run()
        .await
}

async fn handler() -> HttpResult {
    "Hello, World!".respond()
}

Modules§

contracts
Trait contracts for response codes and other abstractions. Trait contracts used throughout the framework.
enums
Enumerations for response codes and status mapping. Enumerations for standardized response codes.
error
HTTP error types with automatic response conversion. HTTP error types for the framework.
helpers
Helper utilities for building JSON responses. Helper utilities for building standardized responses.
http
HTTP kernel, extractors, response helpers, and middleware. HTTP kernel, extractors, response helpers, and middleware.
server
Server configuration and lifecycle management.
testing
Testing utilities for integration tests. Testing utilities for foxtive-axum.

Structs§

App
The core application container.
AppBuilder
A builder for constructing App instances.
Arc
A thread-safe reference-counting pointer. ‘Arc’ stands for ‘Atomically Reference Counted’.