MCPcopy Create free account
hub / github.com/actix/examples / create_app

Function create_app

guards/src/main.rs:51–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49}
50
51fn create_app() -> App<
52 impl ServiceFactory<
53 ServiceRequest,
54 Response = ServiceResponse<impl MessageBody>,
55 Config = (),
56 InitError = (),
57 Error = Error,
58 >,
59> {
60 App::new()
61 .service(web::scope("/api").guard(v1::ApiGuard).service(v1::hello))
62 .service(web::scope("/api").guard(v2::ApiGuard).service(v2::hello))
63 // using this form of API version selection means that we need to send a Vary header so that
64 // caches won't try to serve the wrong response
65 .wrap(DefaultHeaders::new().add(("Vary", "Accept-Version")))
66}
67
68#[actix_web::main]
69async fn main() -> std::io::Result<()> {

Callers 1

api_versioningFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected