1. Examples
  2. Salvo

Hello world!

Simple ‘Hello world’ app using Salvo.

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

cargo shuttle init --salvo

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

name = "hello-world"
version = "0.1.0"
edition = "2021"


salvo = "0.34.3"
shuttle-service = { version = "0.9.0", features = ["web-salvo"] }

Your lib.rs should look like this:

use salvo::prelude::*;

async fn hello_world(res: &mut Response) {
    res.render(Text::Plain("Hello, world!"));

async fn salvo() -> shuttle_service::ShuttleSalvo {
    let router = Router::with_path("hello").get(hello_world);


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

cargo shuttle deploy

And your app is live! 🎉🎉🎉