2019-06-19 18:00:31 -04:00
|
|
|
use actix_web::{guard, web, App, HttpResponse, HttpServer};
|
2018-06-07 21:08:11 -07:00
|
|
|
|
|
|
|
// <vh>
|
2019-12-29 01:15:22 +09:00
|
|
|
#[actix_rt::main]
|
|
|
|
async fn main() -> std::io::Result<()> {
|
2019-06-13 03:24:25 -04:00
|
|
|
HttpServer::new(|| {
|
|
|
|
App::new()
|
|
|
|
.service(
|
|
|
|
web::scope("/")
|
|
|
|
.guard(guard::Header("Host", "www.rust-lang.org"))
|
2019-06-19 18:00:31 -04:00
|
|
|
.route("", web::to(|| HttpResponse::Ok().body("www"))),
|
2019-06-13 03:24:25 -04:00
|
|
|
)
|
|
|
|
.service(
|
|
|
|
web::scope("/")
|
|
|
|
.guard(guard::Header("Host", "users.rust-lang.org"))
|
2019-06-19 18:00:31 -04:00
|
|
|
.route("", web::to(|| HttpResponse::Ok().body("user"))),
|
2019-06-13 03:24:25 -04:00
|
|
|
)
|
|
|
|
.route("/", web::to(|| HttpResponse::Ok()))
|
|
|
|
})
|
2019-12-29 01:15:22 +09:00
|
|
|
.bind("127.0.0.1:8088")?
|
2019-06-19 18:00:31 -04:00
|
|
|
.run()
|
2019-12-29 01:15:22 +09:00
|
|
|
.await
|
2018-06-07 21:08:11 -07:00
|
|
|
}
|
|
|
|
// </vh>
|