1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-05-20 09:18:26 +00:00
actix-web/actix-web/MIGRATION-2.0.md

44 lines
1.3 KiB
Markdown
Raw Permalink Normal View History

2022-02-02 02:46:37 +00:00
# Migrating to 2.0.0
2023-02-26 00:55:57 +00:00
- `HttpServer::start()` renamed to `HttpServer::run()`. It also possible to `.await` on `run` method result, in that case it awaits server exit.
2022-02-02 02:46:37 +00:00
2023-02-26 00:55:57 +00:00
- `App::register_data()` renamed to `App::app_data()` and accepts any type `T: 'static`. Stored data is available via `HttpRequest::app_data()` method at runtime.
2022-02-02 02:46:37 +00:00
- Extractor configuration must be registered with `App::app_data()` instead of `App::data()`
2023-02-26 00:55:57 +00:00
- Sync handlers has been removed. `.to_async()` method has been renamed to `.to()` replace `fn` with `async fn` to convert sync handler to async
2022-02-02 02:46:37 +00:00
2023-02-26 00:55:57 +00:00
- `actix_http_test::TestServer` moved to `actix_web::test` module. To start test server use `test::start()` or `test_start_with_config()` methods
2022-02-02 02:46:37 +00:00
2023-02-26 00:55:57 +00:00
- `ResponseError` trait has been refactored. `ResponseError::error_response()` renders http response.
2022-02-02 02:46:37 +00:00
- Feature `rust-tls` renamed to `rustls`
instead of
```rust
actix-web = { version = "2.0.0", features = ["rust-tls"] }
```
use
```rust
actix-web = { version = "2.0.0", features = ["rustls"] }
```
- Feature `ssl` renamed to `openssl`
instead of
```rust
actix-web = { version = "2.0.0", features = ["ssl"] }
```
use
```rust
actix-web = { version = "2.0.0", features = ["openssl"] }
```
- `Cors` builder now requires that you call `.finish()` to construct the middleware