mirror of
https://github.com/actix/actix-website
synced 2024-11-27 18:12:57 +01:00
19 lines
414 B
Rust
19 lines
414 B
Rust
// <guard2>
|
|
use actix_web::{guard, web, App, HttpResponse, HttpServer};
|
|
|
|
#[actix_web::main]
|
|
async fn main() -> std::io::Result<()> {
|
|
HttpServer::new(|| {
|
|
App::new().route(
|
|
"/",
|
|
web::route()
|
|
.guard(guard::Not(guard::Get()))
|
|
.to(HttpResponse::MethodNotAllowed),
|
|
)
|
|
})
|
|
.bind(("127.0.0.1", 8080))?
|
|
.run()
|
|
.await
|
|
}
|
|
// </guard2>
|