40 breaking releases

0.52.0 Feb 4, 2025
0.50.0 Jan 7, 2025
0.49.0 Nov 12, 2024
0.47.0 Jul 23, 2024
0.13.0 Mar 27, 2023

#1024 in HTTP server

Download history 69/week @ 2024-11-06 53/week @ 2024-11-13 9/week @ 2024-11-20 3/week @ 2024-11-27 14/week @ 2024-12-04 31/week @ 2024-12-11 51/week @ 2025-01-01 208/week @ 2025-01-08 4/week @ 2025-01-15 51/week @ 2025-01-29 69/week @ 2025-02-05

131 downloads per month

Apache-2.0

46KB
796 lines

Shuttle service integration for the Thruster web framework

Example

use thruster::{
    context::basic_hyper_context::{generate_context, BasicHyperContext as Ctx, HyperRequest},
    m, middleware_fn, App, HyperServer, MiddlewareNext, MiddlewareResult, ThrusterServer,
};

#[middleware_fn]
async fn hello(mut context: Ctx, _next: MiddlewareNext<Ctx>) -> MiddlewareResult<Ctx> {
    context.body("Hello, World!");
    Ok(context)
}

#[shuttle_runtime::main]
async fn thruster() -> shuttle_thruster::ShuttleThruster<HyperServer<Ctx, ()>> {
    let server = HyperServer::new(
        App::<HyperRequest, Ctx, ()>::create(generate_context, ()).get("/", m![hello]),
    );

    Ok(server.into())
}

Dependencies

~14–27MB
~379K SLoC