mirror of
https://github.com/actix/actix-website
synced 2025-02-23 20:53:01 +01:00
18 lines
429 B
Rust
18 lines
429 B
Rust
use actix_web::{guard, web, App, HttpRequest, HttpResponse, Responder};
|
|
|
|
fn index(_req: HttpRequest) -> impl Responder {
|
|
"Welcome!"
|
|
}
|
|
|
|
// <default>
|
|
fn main() {
|
|
App::new()
|
|
.service(web::resource("/").route(web::get().to(index)))
|
|
.default_service(
|
|
web::route()
|
|
.guard(guard::Not(guard::Get()))
|
|
.to(|| HttpResponse::MethodNotAllowed()),
|
|
);
|
|
}
|
|
// </default>
|