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>
|
2020-09-12 16:21:54 +01:00
|
|
|
#[actix_web::main]
|
2019-12-29 01:15:22 +09:00
|
|
|
async fn main() -> std::io::Result<()> {
|
2019-06-13 03:24:25 -04:00
|
|
|
HttpServer::new(|| {
|
|
|
|
App::new()
|
|
|
|
.service(
|
|
|
|
web::scope("/")
|
2023-03-14 14:45:18 +01:00
|
|
|
.guard(guard::Host("www.rust-lang.org"))
|
2022-02-26 03:56:24 +00:00
|
|
|
.route("", web::to(|| async { HttpResponse::Ok().body("www") })),
|
2019-06-13 03:24:25 -04:00
|
|
|
)
|
|
|
|
.service(
|
|
|
|
web::scope("/")
|
2023-03-14 14:45:18 +01:00
|
|
|
.guard(guard::Host("users.rust-lang.org"))
|
2022-02-26 03:56:24 +00:00
|
|
|
.route("", web::to(|| async { HttpResponse::Ok().body("user") })),
|
2019-06-13 03:24:25 -04:00
|
|
|
)
|
2022-02-26 03:56:24 +00:00
|
|
|
.route("/", web::to(HttpResponse::Ok))
|
2019-06-13 03:24:25 -04:00
|
|
|
})
|
2022-02-26 03:56:24 +00:00
|
|
|
.bind(("127.0.0.1", 8080))?
|
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>
|