1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-26 10:27:42 +02:00

stop cloning request across service call (#213)

This commit is contained in:
Rob Ede
2021-12-13 02:49:27 +00:00
committed by GitHub
parent a0c93c62b3
commit 0805f2b1c6
6 changed files with 16 additions and 19 deletions

View File

@ -35,9 +35,13 @@ async fn main() -> std::io::Result<()> {
.allowed_header(header::CONTENT_TYPE)
// set list of headers that are safe to expose
.expose_headers(&[header::CONTENT_DISPOSITION])
// set CORS rules ttl
// set preflight cache TTL
.max_age(3600),
)
.route(
"/{n}/init",
web::to(|path: web::Path<String>| async move { path.into_inner() }),
)
.default_service(web::to(|| async { "Hello world!" }))
})
.bind("127.0.0.1:8080")?