1
0
mirror of https://github.com/actix/examples synced 2025-06-28 18:00:37 +02:00

Add docker_sample to examples collection

This commit is contained in:
curiousdev
2020-02-24 10:48:04 -07:00
committed by Jonathas Conceição
parent dc8d61eb59
commit 50332ca491
5 changed files with 80 additions and 0 deletions

30
docker_sample/src/main.rs Normal file
View File

@ -0,0 +1,30 @@
#[macro_use]
extern crate actix_web;
use actix_web::{web, App, HttpResponse, HttpServer, Responder};
#[get("/")]
async fn index() -> impl Responder {
println!("GET: /");
HttpResponse::Ok().body("Hello world!")
}
#[get("/again")]
async fn again() -> impl Responder {
println!("GET: /again");
HttpResponse::Ok().body("Hello world again!")
}
#[actix_rt::main]
async fn main() -> std::io::Result<()> {
println!("Starting actix-web server");
HttpServer::new(|| {
App::new()
.service(index)
.service(again)
})
.bind("0.0.0.0:5000")?
.run()
.await
}