1
0
mirror of https://github.com/actix/actix-website synced 2024-11-28 18:32:39 +01:00
actix-website/examples/application/src/vh.rs

23 lines
661 B
Rust
Raw Normal View History

2018-06-08 06:08:11 +02:00
#![allow(unused)]
2019-06-13 09:24:25 +02:00
use actix_web::{guard, web, App, HttpRequest, HttpResponse, HttpServer, Responder};
2018-06-08 06:08:11 +02:00
// <vh>
fn main() {
2019-06-13 09:24:25 +02:00
HttpServer::new(|| {
App::new()
.service(
web::scope("/")
.guard(guard::Header("Host", "www.rust-lang.org"))
.route("", web::to(|| HttpResponse::Ok())),
)
.service(
web::scope("/")
.guard(guard::Header("Host", "users.rust-lang.org"))
.route("", web::to(|| HttpResponse::Ok())),
)
.route("/", web::to(|| HttpResponse::Ok()))
})
.run();
2018-06-08 06:08:11 +02:00
}
// </vh>