39 breaking releases

new 0.51.0 Jan 10, 2025
0.49.0 Nov 12, 2024
0.47.0 Jul 23, 2024
0.42.0 Mar 18, 2024
0.13.0 Mar 27, 2023

#1041 in HTTP server

Download history 8/week @ 2024-09-19 131/week @ 2024-09-26 48/week @ 2024-10-03 14/week @ 2024-10-10 97/week @ 2024-11-07 27/week @ 2024-11-14 7/week @ 2024-11-21 7/week @ 2024-11-28 10/week @ 2024-12-05 31/week @ 2024-12-12 71/week @ 2025-01-02

102 downloads per month

Apache-2.0

39KB
689 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

~21–35MB
~542K SLoC