1
0
mirror of https://github.com/actix/actix-website synced 2025-02-08 22:36:07 +01:00
Orhun Parmaksız e72b12218a
Add hosting instructions for Shuttle (#334)
* Add hosting instructions for Shuttle

* move shuttle sample code to examples dir

---------

Co-authored-by: Rob Ede <robjtede@icloud.com>
2023-11-01 15:08:40 +00:00

20 lines
500 B
Rust

#[get("/")]
async fn hello_world() -> impl actix_web::Responder {
"hello world"
}
// <shuttle-hello-world>
use actix_web::{get, web::ServiceConfig};
use shuttle_actix_web::ShuttleActixWeb;
#[shuttle_runtime::main]
async fn main() -> ShuttleActixWeb<impl FnOnce(&mut ServiceConfig) + Send + Clone + 'static> {
let config = move |cfg: &mut ServiceConfig| {
// set up your service here, e.g.:
cfg.service(hello_world);
};
Ok(config.into())
}
// </shuttle-hello-world>