35 breaking releases

new 0.47.0 Jul 23, 2024
0.45.0 May 13, 2024
0.42.0 Mar 18, 2024
0.35.2 Dec 21, 2023
0.13.0 Mar 27, 2023

#500 in HTTP server

Download history 94/week @ 2024-03-27 68/week @ 2024-04-03 3/week @ 2024-04-10 86/week @ 2024-04-17 41/week @ 2024-04-24 116/week @ 2024-05-08 23/week @ 2024-05-15 4/week @ 2024-05-22 4/week @ 2024-05-29 124/week @ 2024-06-12

2,048 downloads per month

Apache-2.0

32KB
507 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

~15–26MB
~385K SLoC