Examples
Other
This section contains examples for the following frameworks: Warp, Tower, Poem, Rocket, Salvo, Thruster, Poem & Tide.
​Hello World
This example provides a simple “Hello, world!” Rust application that you can deploy with Shuttle. It’s a great starting point for learning how to use Shuttle and getting familiar with the deployment process for Rust applications.
In order to get started, initialize your project with cargo shuttle init
and pick the framework you want to use for this example.
Once you are done, your project should be setup with all the required dependencies so go ahead and copy/paste the relevant code snippet from below into your main.rs
file.
#[macro_use]
extern crate rocket;
#[get("/")]
fn index() -> &'static str {
"Hello, world!"
}
#[shuttle_service::main]
async fn rocket() -> shuttle_service::ShuttleRocket {
let rocket = rocket::build().mount("/hello", routes![index]);
Ok(rocket)
}
In order to deploy the example, simply run:
cargo shuttle deploy
If you’re looking for other frameworks, we have more examples with other popular frameworks like Tower and Warp right here.