1
0
mirror of https://github.com/actix/actix-website synced 2025-04-22 13:24:52 +02:00
2022-02-26 03:56:24 +00:00

24 lines
481 B
Rust

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