1
0
mirror of https://github.com/actix/actix-website synced 2025-01-23 08:34:35 +01:00

19 lines
416 B
Rust
Raw Normal View History

2019-06-25 18:20:36 -04:00
// <guard2>
use actix_web::{guard, web, App, HttpResponse, HttpServer};
2020-09-12 16:21:54 +01:00
#[actix_web::main]
2019-12-29 04:10:02 +09:00
async fn main() -> std::io::Result<()> {
2019-06-25 18:20:36 -04:00
HttpServer::new(|| {
App::new().route(
"/",
web::route()
.guard(guard::Not(guard::Get()))
.to(|| HttpResponse::MethodNotAllowed()),
)
})
2020-09-12 16:21:54 +01:00
.bind("127.0.0.1:8080")?
2019-06-25 18:20:36 -04:00
.run()
2019-12-29 04:10:02 +09:00
.await
2019-06-25 18:20:36 -04:00
}
// </guard2>