1
0
mirror of https://github.com/actix/actix-website synced 2025-02-09 06:45:37 +01:00

25 lines
704 B
Rust

use actix_web::{guard, web, App, HttpResponse, HttpServer};
// <vh>
pub fn main() {
HttpServer::new(|| {
App::new()
.service(
web::scope("/")
.guard(guard::Header("Host", "www.rust-lang.org"))
.route("", web::to(|| HttpResponse::Ok().body("www"))),
)
.service(
web::scope("/")
.guard(guard::Header("Host", "users.rust-lang.org"))
.route("", web::to(|| HttpResponse::Ok().body("user"))),
)
.route("/", web::to(|| HttpResponse::Ok()))
})
.bind("127.0.0.1:8088")
.unwrap()
.run()
.unwrap();
}
// </vh>