2019-06-26 00:20:36 +02:00
|
|
|
use actix_web::{guard, web, App, HttpRequest, HttpResponse, HttpServer, Responder};
|
2019-06-17 08:08:42 +02:00
|
|
|
|
|
|
|
fn index(_req: HttpRequest) -> impl Responder {
|
|
|
|
"Welcome!"
|
|
|
|
}
|
2018-05-24 19:13:55 +02:00
|
|
|
|
2019-06-17 08:08:42 +02:00
|
|
|
// <default>
|
2019-06-19 06:20:50 +02:00
|
|
|
pub fn main() {
|
2019-06-26 00:20:36 +02:00
|
|
|
HttpServer::new(|| {
|
|
|
|
App::new()
|
|
|
|
.service(web::resource("/").route(web::get().to(index)))
|
|
|
|
.default_service(
|
|
|
|
web::route()
|
|
|
|
.guard(guard::Not(guard::Get()))
|
|
|
|
.to(|| HttpResponse::MethodNotAllowed()),
|
|
|
|
)
|
|
|
|
})
|
|
|
|
.bind("127.0.0.1:8088")
|
|
|
|
.unwrap()
|
|
|
|
.run()
|
|
|
|
.unwrap();
|
2018-05-24 19:13:55 +02:00
|
|
|
}
|
|
|
|
// </default>
|