2018-05-24 19:13:55 +02:00
|
|
|
// <resource>
|
2019-06-26 00:20:36 +02:00
|
|
|
use actix_web::{guard, web, App, HttpResponse};
|
2018-05-24 19:13:55 +02:00
|
|
|
|
2022-02-26 04:56:24 +01:00
|
|
|
async fn index() -> HttpResponse {
|
2019-06-26 00:20:36 +02:00
|
|
|
HttpResponse::Ok().body("Hello")
|
2018-05-24 19:13:55 +02:00
|
|
|
}
|
|
|
|
|
2019-06-19 06:20:50 +02:00
|
|
|
pub fn main() {
|
2018-05-24 19:13:55 +02:00
|
|
|
App::new()
|
2019-06-17 10:12:11 +02:00
|
|
|
.service(web::resource("/prefix").to(index))
|
2019-06-17 08:08:42 +02:00
|
|
|
.service(
|
2019-06-26 00:20:36 +02:00
|
|
|
web::resource("/user/{name}")
|
|
|
|
.name("user_detail")
|
|
|
|
.guard(guard::Header("content-type", "application/json"))
|
2022-02-26 04:56:24 +01:00
|
|
|
.route(web::get().to(HttpResponse::Ok))
|
|
|
|
.route(web::put().to(HttpResponse::Ok)),
|
2019-06-17 08:08:42 +02:00
|
|
|
);
|
2018-05-24 19:13:55 +02:00
|
|
|
}
|
|
|
|
// </resource>
|