mirror of
https://github.com/actix/examples
synced 2025-06-28 18:00:37 +02:00
Restructure folders (#411)
This commit is contained in:
committed by
GitHub
parent
9db98162b2
commit
c3407627d0
26
basics/docker_sample/src/main.rs
Normal file
26
basics/docker_sample/src/main.rs
Normal file
@ -0,0 +1,26 @@
|
||||
#[macro_use]
|
||||
extern crate actix_web;
|
||||
|
||||
use actix_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_web::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
|
||||
}
|
Reference in New Issue
Block a user