1
0
mirror of https://github.com/actix/actix-website synced 2025-06-27 07:29:02 +02:00

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>
This commit is contained in:
Orhun Parmaksız
2023-11-01 16:08:40 +01:00
committed by GitHub
parent 411a64afd3
commit e72b12218a
7 changed files with 107 additions and 21 deletions

View File

@ -0,0 +1,12 @@
[package]
name = "shuttle"
version = "1.0.0"
edition = "2021"
# <shuttle-deps>
[dependencies]
actix-web = "4"
shuttle-actix-web = "0.30"
shuttle-runtime = "0.30"
tokio = "1"
# </shuttle-deps>

View File

@ -0,0 +1,19 @@
#[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>