1
0
mirror of https://github.com/actix/actix-website synced 2025-02-23 12:43:02 +01:00
Sven-Hendrik Haase 04bca7bf82 Fix PR comments
2019-08-06 01:30:50 +02:00

35 lines
663 B
Rust

// <setup>
use actix_web::{web, App, HttpResponse, HttpServer, Responder};
fn index() -> impl Responder {
HttpResponse::Ok().body("Hello world!")
}
fn index2() -> impl Responder {
HttpResponse::Ok().body("Hello world again!")
}
// </setup>
// <macro-attributes>
use actix_web::get;
#[get("/hello")]
fn index3() -> impl Responder {
HttpResponse::Ok().body("Hey there!")
}
// </macro-attributes>
// <main>
fn main() {
HttpServer::new(|| {
App::new()
.route("/", web::get().to(index))
.route("/again", web::get().to(index2))
})
.bind("127.0.0.1:8088")
.unwrap()
.run()
.unwrap();
}
// </main>