Skip to content

Commit 02b4208

Browse files
authored
Merge pull request #3 from biryukovmaxim/feature/actix-web-example
Feature/actix web example
2 parents 41e487d + 21d24ff commit 02b4208

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

actix-web/hello-world/Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[package]
2+
name = "hello-world"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
actix-service = "2.0.2"
8+
actix-web = "4.2.1"
9+
shuttle-service = { version = '0.7.2', features = ["web-actix-web"] }
10+

actix-web/hello-world/Shuttle.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
name = "hello-world-actix-web-app"

actix-web/hello-world/src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use actix_web::web::{resource, ServiceConfig};
2+
use shuttle_service::ShuttleActixWeb;
3+
4+
async fn hello_world() -> &'static str {
5+
"Hello World!"
6+
}
7+
8+
#[shuttle_service::main]
9+
async fn actix_web(
10+
) -> ShuttleActixWeb<impl FnOnce(&mut ServiceConfig) + Sync + Send + Copy + Clone + 'static> {
11+
Ok(move |cfg: &mut ServiceConfig| {
12+
cfg.service(resource("/hello").to(hello_world));
13+
})
14+
}

0 commit comments

Comments
 (0)