1. Examples
  2. Warp

Hello world!

Simple ‘Hello world’ app using Warp.

Create a new directory (mkdir) and move into it (cd) — afterwards, execute the following command to initialize shuttle inside with the Warp boilerplate.

cargo shuttle init --warp

Make sure that your Cargo.toml file looks like the one below — having the right dependencies is key!

Cargo.toml
[package]
name = "hello-world"
version = "0.1.0"
edition = "2021"

[lib]

[dependencies]
shuttle-service = { version = "0.9.0", features = ["web-warp"] }
warp = "0.3.2"

Your lib.rs should look like this:

lib.rs
use warp::Filter;
use warp::Reply;

#[shuttle_service::main]
async fn warp() -> shuttle_service::ShuttleWarp<(impl Reply,)> {
    let route = warp::any().map(|| "Hello, World");
    Ok(route.boxed())
}

Finally, to deploy your app, all you need to do is:

cargo shuttle deploy

And your app is live! 🎉🎉🎉