1
0
mirror of https://github.com/actix/actix-website synced 2024-12-18 01:43:59 +01:00
actix-website/examples/url-dispatch/src/cfg.rs
2019-06-25 18:20:36 -04:00

24 lines
456 B
Rust

use actix_web::{guard, web, App, HttpResponse};
#[rustfmt::skip]
pub fn main() {
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")
.unwrap()
.run()
.unwrap();
}