1
0
mirror of https://github.com/actix/actix-website synced 2024-11-28 02:22:57 +01:00
actix-website/examples/url-dispatch/src/cfg.rs
2019-12-29 04:10:02 +09:00

24 lines
482 B
Rust

use actix_web::{guard, web, App, HttpResponse};
#[rustfmt::skip]
#[actix_rt::main]
async fn main() -> std::io::Result<()> {
use actix_web::HttpServer;
HttpServer::new(|| {
// <cfg>
App::new().service(
web::resource("/path").route(
web::route()
.guard(guard::Get())
.guard(guard::Header("content-type", "text/plain"))
.to(|| HttpResponse::Ok()),
),
)
// </cfg>
})
.bind("127.0.0.1:8088")?
.run()
.await
}