1
0
mirror of https://github.com/actix/actix-website synced 2024-11-24 00:41:07 +01:00

Merge pull request #160 from actix/remove-create-app

remove unusable create_app example
This commit is contained in:
Yuki Okushi 2020-02-17 09:05:13 +09:00 committed by GitHub
commit 845ab78512
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 28 deletions

View File

@ -108,13 +108,7 @@ The result of the above example would be:
/app -> "app"
/api/test -> "test"
```
Each `ServiceConfig` can have it's own `data`, `routes`, and `services`
It is also possible to create application object in separate function.
`App` type uses complex generics and result type have to use `impl Trait` feature.
This could be useful for unit tests.
{{< include-example example="application" file="config_app.rs" section="config" >}}
Each [`ServiceConfig`][serviceconfig] can have it's own `data`, `routes`, and `services`.
[usingappprefix]: /docs/url-dispatch/index.html#using-an-application-prefix-to-compose-applications
[stateexample]: https://github.com/actix/examples/blob/master/state/src/main.rs
@ -129,3 +123,4 @@ This could be useful for unit tests.
[webscopeconfig]: https://docs.rs/actix-web/2/actix_web/struct.Scope.html#method.configure
[webscope]: https://docs.rs/actix-web/2/actix_web/web/fn.scope.html
[urlfor]: https://docs.rs/actix-web/2/actix_web/struct.HttpRequest.html#method.url_for
[serviceconfig]: https://docs.rs/actix-web/2/actix_web/web/struct.ServiceConfig.html

View File

@ -1,20 +0,0 @@
// <config>
use actix_service::ServiceFactory;
use actix_web::dev::{MessageBody, ServiceRequest, ServiceResponse};
use actix_web::{web, App, Error, HttpResponse};
fn create_app() -> App<
impl ServiceFactory<
Config = (),
Request = ServiceRequest,
Response = ServiceResponse<impl MessageBody>,
Error = Error,
>,
impl MessageBody,
> {
App::new().service(
web::scope("/app")
.route("/index.html", web::get().to(|| HttpResponse::Ok())),
)
}
// </config>

View File

@ -3,7 +3,6 @@ use actix_web::{web, App, HttpResponse, HttpServer};
pub mod app;
pub mod combine;
pub mod config;
pub mod config_app;
pub mod scope;
pub mod state;
pub mod vh;