2019-06-17 16:57:57 -04:00
|
|
|
// <default-headers>
|
2022-02-26 03:56:24 +00:00
|
|
|
use actix_web::{http::Method, middleware, web, App, HttpResponse, HttpServer};
|
2019-06-17 16:57:57 -04:00
|
|
|
|
2020-09-12 16:21:54 +01:00
|
|
|
#[actix_web::main]
|
2019-12-29 02:03:17 +09:00
|
|
|
async fn main() -> std::io::Result<()> {
|
2019-06-26 02:59:20 -04:00
|
|
|
HttpServer::new(|| {
|
|
|
|
App::new()
|
2022-02-26 03:56:24 +00:00
|
|
|
.wrap(middleware::DefaultHeaders::new().add(("X-Version", "0.2")))
|
2019-06-26 02:59:20 -04:00
|
|
|
.service(
|
|
|
|
web::resource("/test")
|
2022-02-26 03:56:24 +00:00
|
|
|
.route(web::get().to(HttpResponse::Ok))
|
|
|
|
.route(web::method(Method::HEAD).to(HttpResponse::MethodNotAllowed)),
|
2019-06-26 02:59:20 -04:00
|
|
|
)
|
|
|
|
})
|
2022-02-26 03:56:24 +00:00
|
|
|
.bind(("127.0.0.1", 8080))?
|
2019-06-26 02:59:20 -04:00
|
|
|
.run()
|
2019-12-29 02:03:17 +09:00
|
|
|
.await
|
2019-06-17 16:57:57 -04:00
|
|
|
}
|
|
|
|
// </default-headers>
|