mirror of
https://github.com/actix/actix-website
synced 2025-02-08 22:36:07 +01:00
* Add hosting instructions for Shuttle * move shuttle sample code to examples dir --------- Co-authored-by: Rob Ede <robjtede@icloud.com>
20 lines
500 B
Rust
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>
|