1
0
mirror of https://github.com/actix/actix-website synced 2025-02-24 04:53:20 +01:00

26 lines
503 B
Rust
Raw Normal View History

2018-05-23 23:25:51 +02:00
// <setup>
2019-06-28 13:31:30 -04:00
use actix_web::{web, App, HttpResponse, HttpServer, Responder};
2018-05-23 23:25:51 +02:00
fn index() -> impl Responder {
2019-06-12 04:51:45 -04:00
HttpResponse::Ok().body("Hello world!")
2018-05-23 23:25:51 +02:00
}
2019-06-28 13:31:30 -04:00
fn index2() -> impl Responder {
HttpResponse::Ok().body("Hello world again!")
}
2018-05-23 23:25:51 +02:00
// </setup>
2019-06-12 04:56:59 -04:00
2018-05-23 23:25:51 +02:00
// <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();
2018-05-23 23:25:51 +02:00
}
// </main>