Skip to content
Dashboard

Rust runtime now in public beta for Vercel Functions

Software Engineer
Cargo.toml
[package]
name = "rust-hello-world"
version = "0.1.0"
edition = "2024"
[dependencies]
tokio = { version = "1", features = ["full"] }
vercel_runtime = { version = "2" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
[[bin]]
name = "hello"
path = "api/hello.rs"

api/hello.rs
use serde_json::{Value, json};
use vercel_runtime::{Error, Request, run, service_fn};
#[tokio::main]
async fn main() -> Result<(), Error> {
let service = service_fn(handler);
run(service).await
}
async fn handler(_req: Request) -> Result<Value, Error> {
Ok(json!({
"message": "Hello, world!",
}))
}