mirror of
https://github.com/actix/actix-website
synced 2024-11-24 08:43:01 +01:00
Merge pull request #160 from actix/remove-create-app
remove unusable create_app example
This commit is contained in:
commit
845ab78512
@ -108,13 +108,7 @@ The result of the above example would be:
|
|||||||
/app -> "app"
|
/app -> "app"
|
||||||
/api/test -> "test"
|
/api/test -> "test"
|
||||||
```
|
```
|
||||||
Each `ServiceConfig` can have it's own `data`, `routes`, and `services`
|
Each [`ServiceConfig`][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" >}}
|
|
||||||
|
|
||||||
[usingappprefix]: /docs/url-dispatch/index.html#using-an-application-prefix-to-compose-applications
|
[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
|
[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
|
[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
|
[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
|
[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
|
||||||
|
@ -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>
|
|
@ -3,7 +3,6 @@ use actix_web::{web, App, HttpResponse, HttpServer};
|
|||||||
pub mod app;
|
pub mod app;
|
||||||
pub mod combine;
|
pub mod combine;
|
||||||
pub mod config;
|
pub mod config;
|
||||||
pub mod config_app;
|
|
||||||
pub mod scope;
|
pub mod scope;
|
||||||
pub mod state;
|
pub mod state;
|
||||||
pub mod vh;
|
pub mod vh;
|
||||||
|
Loading…
Reference in New Issue
Block a user