#shuttle-service #thruster

shuttle-thruster

Service implementation to run a thruster webserver on shuttle

27 breaking releases

new 0.39.0 Feb 14, 2024
0.37.0 Jan 24, 2024
0.35.2 Dec 21, 2023
0.34.1 Nov 29, 2023
0.13.0 Mar 27, 2023

#2 in #thruster

Download history 49/week @ 2023-10-30 31/week @ 2023-11-06 34/week @ 2023-11-13 79/week @ 2023-11-20 107/week @ 2023-11-27 88/week @ 2023-12-04 60/week @ 2023-12-11 28/week @ 2023-12-18 60/week @ 2023-12-25 33/week @ 2024-01-01 32/week @ 2024-01-08 4/week @ 2024-01-15 40/week @ 2024-01-22 101/week @ 2024-01-29 7/week @ 2024-02-05 311/week @ 2024-02-12

459 downloads per month

Apache-2.0

4KB

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

~24–39MB
~676K SLoC