mirror of
https://github.com/fafhrd91/actix-web
synced 2025-01-18 05:41:50 +01:00
move actix-web to own dir
This commit is contained in:
parent
30aa64ea32
commit
bcdde1d4ea
1031
CHANGES.md
1031
CHANGES.md
File diff suppressed because it is too large
Load Diff
147
Cargo.toml
147
Cargo.toml
@ -1,36 +1,6 @@
|
|||||||
[package]
|
|
||||||
name = "actix-web"
|
|
||||||
version = "4.0.0-rc.1"
|
|
||||||
authors = [
|
|
||||||
"Nikolay Kim <fafhrd91@gmail.com>",
|
|
||||||
"Rob Ede <robjtede@icloud.com>",
|
|
||||||
]
|
|
||||||
description = "Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust"
|
|
||||||
keywords = ["actix", "http", "web", "framework", "async"]
|
|
||||||
categories = [
|
|
||||||
"network-programming",
|
|
||||||
"asynchronous",
|
|
||||||
"web-programming::http-server",
|
|
||||||
"web-programming::websocket"
|
|
||||||
]
|
|
||||||
homepage = "https://actix.rs"
|
|
||||||
repository = "https://github.com/actix/actix-web.git"
|
|
||||||
license = "MIT OR Apache-2.0"
|
|
||||||
edition = "2018"
|
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
|
||||||
# features that docs.rs will build with
|
|
||||||
features = ["openssl", "rustls", "compress-brotli", "compress-gzip", "compress-zstd", "cookies", "secure-cookies"]
|
|
||||||
rustdoc-args = ["--cfg", "docsrs"]
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "actix_web"
|
|
||||||
path = "src/lib.rs"
|
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
members = [
|
members = [
|
||||||
".",
|
|
||||||
"actix-files",
|
"actix-files",
|
||||||
"actix-http-test",
|
"actix-http-test",
|
||||||
"actix-http",
|
"actix-http",
|
||||||
@ -39,93 +9,10 @@ members = [
|
|||||||
"actix-test",
|
"actix-test",
|
||||||
"actix-web-actors",
|
"actix-web-actors",
|
||||||
"actix-web-codegen",
|
"actix-web-codegen",
|
||||||
|
"actix-web",
|
||||||
"awc",
|
"awc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[features]
|
|
||||||
default = ["compress-brotli", "compress-gzip", "compress-zstd", "cookies"]
|
|
||||||
|
|
||||||
# Brotli algorithm content-encoding support
|
|
||||||
compress-brotli = ["actix-http/compress-brotli", "__compress"]
|
|
||||||
# Gzip and deflate algorithms content-encoding support
|
|
||||||
compress-gzip = ["actix-http/compress-gzip", "__compress"]
|
|
||||||
# Zstd algorithm content-encoding support
|
|
||||||
compress-zstd = ["actix-http/compress-zstd", "__compress"]
|
|
||||||
|
|
||||||
# support for cookies
|
|
||||||
cookies = ["cookie"]
|
|
||||||
|
|
||||||
# secure cookies feature
|
|
||||||
secure-cookies = ["cookie/secure"]
|
|
||||||
|
|
||||||
# openssl
|
|
||||||
openssl = ["actix-http/openssl", "actix-tls/accept", "actix-tls/openssl"]
|
|
||||||
|
|
||||||
# rustls
|
|
||||||
rustls = ["actix-http/rustls", "actix-tls/accept", "actix-tls/rustls"]
|
|
||||||
|
|
||||||
# Internal (PRIVATE!) features used to aid testing and checking feature status.
|
|
||||||
# Don't rely on these whatsoever. They may disappear at anytime.
|
|
||||||
__compress = []
|
|
||||||
|
|
||||||
# io-uring feature only avaiable for Linux OSes.
|
|
||||||
experimental-io-uring = ["actix-server/io-uring"]
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
actix-codec = "0.4.1"
|
|
||||||
actix-macros = "0.2.3"
|
|
||||||
actix-rt = "2.6"
|
|
||||||
actix-server = "2"
|
|
||||||
actix-service = "2.0.0"
|
|
||||||
actix-utils = "3.0.0"
|
|
||||||
actix-tls = { version = "3.0.0", default-features = false, optional = true }
|
|
||||||
|
|
||||||
actix-http = { version = "3.0.0-rc.1", features = ["http2", "ws"] }
|
|
||||||
actix-router = "0.5.0-rc.3"
|
|
||||||
actix-web-codegen = "0.5.0-rc.2"
|
|
||||||
|
|
||||||
ahash = "0.7"
|
|
||||||
bytes = "1"
|
|
||||||
cfg-if = "1"
|
|
||||||
cookie = { version = "0.16", features = ["percent-encode"], optional = true }
|
|
||||||
derive_more = "0.99.5"
|
|
||||||
encoding_rs = "0.8"
|
|
||||||
futures-core = { version = "0.3.7", default-features = false }
|
|
||||||
futures-util = { version = "0.3.7", default-features = false }
|
|
||||||
itoa = "1"
|
|
||||||
language-tags = "0.3"
|
|
||||||
once_cell = "1.5"
|
|
||||||
log = "0.4"
|
|
||||||
mime = "0.3"
|
|
||||||
pin-project-lite = "0.2.7"
|
|
||||||
regex = "1.4"
|
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
|
||||||
serde_json = "1.0"
|
|
||||||
serde_urlencoded = "0.7"
|
|
||||||
smallvec = "1.6.1"
|
|
||||||
socket2 = "0.4.0"
|
|
||||||
time = { version = "0.3", default-features = false, features = ["formatting"] }
|
|
||||||
url = "2.1"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
actix-files = "0.6.0-beta.16"
|
|
||||||
actix-test = { version = "0.1.0-beta.12", features = ["openssl", "rustls"] }
|
|
||||||
awc = { version = "3.0.0-beta.20", features = ["openssl"] }
|
|
||||||
|
|
||||||
brotli = "3.3.3"
|
|
||||||
const-str = "0.3"
|
|
||||||
criterion = { version = "0.3", features = ["html_reports"] }
|
|
||||||
env_logger = "0.9"
|
|
||||||
flate2 = "1.0.13"
|
|
||||||
futures-util = { version = "0.3.7", default-features = false, features = ["std"] }
|
|
||||||
rand = "0.8"
|
|
||||||
rcgen = "0.8"
|
|
||||||
rustls-pemfile = "0.2"
|
|
||||||
static_assertions = "1"
|
|
||||||
tls-openssl = { package = "openssl", version = "0.10.9" }
|
|
||||||
tls-rustls = { package = "rustls", version = "0.20.0" }
|
|
||||||
zstd = "0.9"
|
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
# Disabling debug info speeds up builds a bunch and we don't rely on it for debugging that much.
|
# Disabling debug info speeds up builds a bunch and we don't rely on it for debugging that much.
|
||||||
debug = 0
|
debug = 0
|
||||||
@ -155,35 +42,3 @@ awc = { path = "awc" }
|
|||||||
# actix-utils = { path = "../actix-net/actix-utils" }
|
# actix-utils = { path = "../actix-net/actix-utils" }
|
||||||
# actix-tls = { path = "../actix-net/actix-tls" }
|
# actix-tls = { path = "../actix-net/actix-tls" }
|
||||||
# actix-server = { path = "../actix-net/actix-server" }
|
# actix-server = { path = "../actix-net/actix-server" }
|
||||||
|
|
||||||
[[test]]
|
|
||||||
name = "test_server"
|
|
||||||
required-features = ["compress-brotli", "compress-gzip", "compress-zstd", "cookies"]
|
|
||||||
|
|
||||||
[[test]]
|
|
||||||
name = "compression"
|
|
||||||
required-features = ["compress-brotli", "compress-gzip", "compress-zstd"]
|
|
||||||
|
|
||||||
[[example]]
|
|
||||||
name = "basic"
|
|
||||||
required-features = ["compress-gzip"]
|
|
||||||
|
|
||||||
[[example]]
|
|
||||||
name = "uds"
|
|
||||||
required-features = ["compress-gzip"]
|
|
||||||
|
|
||||||
[[example]]
|
|
||||||
name = "on-connect"
|
|
||||||
required-features = []
|
|
||||||
|
|
||||||
[[bench]]
|
|
||||||
name = "server"
|
|
||||||
harness = false
|
|
||||||
|
|
||||||
[[bench]]
|
|
||||||
name = "service"
|
|
||||||
harness = false
|
|
||||||
|
|
||||||
[[bench]]
|
|
||||||
name = "responder"
|
|
||||||
harness = false
|
|
||||||
|
105
README.md
105
README.md
@ -1,105 +0,0 @@
|
|||||||
<div align="center">
|
|
||||||
<h1>Actix Web</h1>
|
|
||||||
<p>
|
|
||||||
<strong>Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust</strong>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
|
|
||||||
[![crates.io](https://img.shields.io/crates/v/actix-web?label=latest)](https://crates.io/crates/actix-web)
|
|
||||||
[![Documentation](https://docs.rs/actix-web/badge.svg?version=4.0.0-rc.1)](https://docs.rs/actix-web/4.0.0-rc.1)
|
|
||||||
![MSRV](https://img.shields.io/badge/rustc-1.54+-ab6000.svg)
|
|
||||||
![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-web.svg)
|
|
||||||
[![Dependency Status](https://deps.rs/crate/actix-web/4.0.0-rc.1/status.svg)](https://deps.rs/crate/actix-web/4.0.0-rc.1)
|
|
||||||
<br />
|
|
||||||
[![CI](https://github.com/actix/actix-web/actions/workflows/ci.yml/badge.svg)](https://github.com/actix/actix-web/actions/workflows/ci.yml)
|
|
||||||
[![codecov](https://codecov.io/gh/actix/actix-web/branch/master/graph/badge.svg)](https://codecov.io/gh/actix/actix-web)
|
|
||||||
![downloads](https://img.shields.io/crates/d/actix-web.svg)
|
|
||||||
[![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/NWpN5mmg3x)
|
|
||||||
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- Supports _HTTP/1.x_ and _HTTP/2_
|
|
||||||
- Streaming and pipelining
|
|
||||||
- Powerful [request routing](https://actix.rs/docs/url-dispatch/) with optional macros
|
|
||||||
- Full [Tokio](https://tokio.rs) compatibility
|
|
||||||
- Keep-alive and slow requests handling
|
|
||||||
- Client/server [WebSockets](https://actix.rs/docs/websockets/) support
|
|
||||||
- Transparent content compression/decompression (br, gzip, deflate, zstd)
|
|
||||||
- Multipart streams
|
|
||||||
- Static assets
|
|
||||||
- SSL support using OpenSSL or Rustls
|
|
||||||
- Middlewares ([Logger, Session, CORS, etc](https://actix.rs/docs/middleware/))
|
|
||||||
- Includes an async [HTTP client](https://docs.rs/awc/)
|
|
||||||
- Runs on stable Rust 1.54+
|
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
- [Website & User Guide](https://actix.rs)
|
|
||||||
- [Examples Repository](https://github.com/actix/examples)
|
|
||||||
- [API Documentation](https://docs.rs/actix-web)
|
|
||||||
- [API Documentation (master branch)](https://actix.rs/actix-web/actix_web)
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
Dependencies:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
[dependencies]
|
|
||||||
actix-web = "4.0.0-rc.1"
|
|
||||||
```
|
|
||||||
|
|
||||||
Code:
|
|
||||||
|
|
||||||
```rust
|
|
||||||
use actix_web::{get, web, App, HttpServer, Responder};
|
|
||||||
|
|
||||||
#[get("/{id}/{name}/index.html")]
|
|
||||||
async fn index(params: web::Path<(u32, String)>) -> impl Responder {
|
|
||||||
let (id, name) = params.into_inner();
|
|
||||||
format!("Hello {}! id:{}", name, id)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[actix_web::main] // or #[tokio::main]
|
|
||||||
async fn main() -> std::io::Result<()> {
|
|
||||||
HttpServer::new(|| App::new().service(index))
|
|
||||||
.bind(("127.0.0.1", 8080))?
|
|
||||||
.run()
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### More examples
|
|
||||||
|
|
||||||
- [Basic Setup](https://github.com/actix/examples/tree/master/basics/basics/)
|
|
||||||
- [Application State](https://github.com/actix/examples/tree/master/basics/state/)
|
|
||||||
- [JSON Handling](https://github.com/actix/examples/tree/master/json/json/)
|
|
||||||
- [Multipart Streams](https://github.com/actix/examples/tree/master/forms/multipart/)
|
|
||||||
- [Diesel Integration](https://github.com/actix/examples/tree/master/database_interactions/diesel/)
|
|
||||||
- [r2d2 Integration](https://github.com/actix/examples/tree/master/database_interactions/r2d2/)
|
|
||||||
- [Simple WebSocket](https://github.com/actix/examples/tree/master/websockets/websocket/)
|
|
||||||
- [Tera Templates](https://github.com/actix/examples/tree/master/template_engines/tera/)
|
|
||||||
- [Askama Templates](https://github.com/actix/examples/tree/master/template_engines/askama/)
|
|
||||||
- [HTTPS using Rustls](https://github.com/actix/examples/tree/master/security/rustls/)
|
|
||||||
- [HTTPS using OpenSSL](https://github.com/actix/examples/tree/master/security/openssl/)
|
|
||||||
- [WebSocket Chat](https://github.com/actix/examples/tree/master/websockets/chat/)
|
|
||||||
|
|
||||||
You may consider checking out [this directory](https://github.com/actix/examples/tree/master/) for more examples.
|
|
||||||
|
|
||||||
## Benchmarks
|
|
||||||
|
|
||||||
One of the fastest web frameworks available according to the [TechEmpower Framework Benchmark](https://www.techempower.com/benchmarks/#section=data-r20&test=composite).
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
This project is licensed under either of the following licenses, at your option:
|
|
||||||
|
|
||||||
- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or [http://www.apache.org/licenses/LICENSE-2.0])
|
|
||||||
- MIT license ([LICENSE-MIT](LICENSE-MIT) or [http://opensource.org/licenses/MIT])
|
|
||||||
|
|
||||||
## Code of Conduct
|
|
||||||
|
|
||||||
Contribution to the actix-web repo is organized under the terms of the Contributor Covenant.
|
|
||||||
The Actix team promises to intervene to uphold that code of conduct.
|
|
1032
actix-web/CHANGES.md
Normal file
1032
actix-web/CHANGES.md
Normal file
File diff suppressed because it is too large
Load Diff
144
actix-web/Cargo.toml
Normal file
144
actix-web/Cargo.toml
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
[package]
|
||||||
|
name = "actix-web"
|
||||||
|
version = "4.0.0-rc.1"
|
||||||
|
authors = [
|
||||||
|
"Nikolay Kim <fafhrd91@gmail.com>",
|
||||||
|
"Rob Ede <robjtede@icloud.com>",
|
||||||
|
]
|
||||||
|
description = "Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust"
|
||||||
|
keywords = ["actix", "http", "web", "framework", "async"]
|
||||||
|
categories = [
|
||||||
|
"network-programming",
|
||||||
|
"asynchronous",
|
||||||
|
"web-programming::http-server",
|
||||||
|
"web-programming::websocket"
|
||||||
|
]
|
||||||
|
homepage = "https://actix.rs"
|
||||||
|
repository = "https://github.com/actix/actix-web.git"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[package.metadata.docs.rs]
|
||||||
|
# features that docs.rs will build with
|
||||||
|
features = ["openssl", "rustls", "compress-brotli", "compress-gzip", "compress-zstd", "cookies", "secure-cookies"]
|
||||||
|
rustdoc-args = ["--cfg", "docsrs"]
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "actix_web"
|
||||||
|
path = "src/lib.rs"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["compress-brotli", "compress-gzip", "compress-zstd", "cookies"]
|
||||||
|
|
||||||
|
# Brotli algorithm content-encoding support
|
||||||
|
compress-brotli = ["actix-http/compress-brotli", "__compress"]
|
||||||
|
# Gzip and deflate algorithms content-encoding support
|
||||||
|
compress-gzip = ["actix-http/compress-gzip", "__compress"]
|
||||||
|
# Zstd algorithm content-encoding support
|
||||||
|
compress-zstd = ["actix-http/compress-zstd", "__compress"]
|
||||||
|
|
||||||
|
# support for cookies
|
||||||
|
cookies = ["cookie"]
|
||||||
|
|
||||||
|
# secure cookies feature
|
||||||
|
secure-cookies = ["cookie/secure"]
|
||||||
|
|
||||||
|
# openssl
|
||||||
|
openssl = ["actix-http/openssl", "actix-tls/accept", "actix-tls/openssl"]
|
||||||
|
|
||||||
|
# rustls
|
||||||
|
rustls = ["actix-http/rustls", "actix-tls/accept", "actix-tls/rustls"]
|
||||||
|
|
||||||
|
# Internal (PRIVATE!) features used to aid testing and checking feature status.
|
||||||
|
# Don't rely on these whatsoever. They may disappear at anytime.
|
||||||
|
__compress = []
|
||||||
|
|
||||||
|
# io-uring feature only avaiable for Linux OSes.
|
||||||
|
experimental-io-uring = ["actix-server/io-uring"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
actix-codec = "0.4.1"
|
||||||
|
actix-macros = "0.2.3"
|
||||||
|
actix-rt = "2.6"
|
||||||
|
actix-server = "2"
|
||||||
|
actix-service = "2.0.0"
|
||||||
|
actix-utils = "3.0.0"
|
||||||
|
actix-tls = { version = "3.0.0", default-features = false, optional = true }
|
||||||
|
|
||||||
|
actix-http = { version = "3.0.0-rc.1", features = ["http2", "ws"] }
|
||||||
|
actix-router = "0.5.0-rc.3"
|
||||||
|
actix-web-codegen = "0.5.0-rc.2"
|
||||||
|
|
||||||
|
ahash = "0.7"
|
||||||
|
bytes = "1"
|
||||||
|
cfg-if = "1"
|
||||||
|
cookie = { version = "0.16", features = ["percent-encode"], optional = true }
|
||||||
|
derive_more = "0.99.5"
|
||||||
|
encoding_rs = "0.8"
|
||||||
|
futures-core = { version = "0.3.7", default-features = false }
|
||||||
|
futures-util = { version = "0.3.7", default-features = false }
|
||||||
|
itoa = "1"
|
||||||
|
language-tags = "0.3"
|
||||||
|
once_cell = "1.5"
|
||||||
|
log = "0.4"
|
||||||
|
mime = "0.3"
|
||||||
|
pin-project-lite = "0.2.7"
|
||||||
|
regex = "1.4"
|
||||||
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
serde_json = "1.0"
|
||||||
|
serde_urlencoded = "0.7"
|
||||||
|
smallvec = "1.6.1"
|
||||||
|
socket2 = "0.4.0"
|
||||||
|
time = { version = "0.3", default-features = false, features = ["formatting"] }
|
||||||
|
url = "2.1"
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
actix-files = "0.6.0-beta.16"
|
||||||
|
actix-test = { version = "0.1.0-beta.12", features = ["openssl", "rustls"] }
|
||||||
|
awc = { version = "3.0.0-beta.20", features = ["openssl"] }
|
||||||
|
|
||||||
|
brotli = "3.3.3"
|
||||||
|
const-str = "0.3"
|
||||||
|
criterion = { version = "0.3", features = ["html_reports"] }
|
||||||
|
env_logger = "0.9"
|
||||||
|
flate2 = "1.0.13"
|
||||||
|
futures-util = { version = "0.3.7", default-features = false, features = ["std"] }
|
||||||
|
rand = "0.8"
|
||||||
|
rcgen = "0.8"
|
||||||
|
rustls-pemfile = "0.2"
|
||||||
|
static_assertions = "1"
|
||||||
|
tls-openssl = { package = "openssl", version = "0.10.9" }
|
||||||
|
tls-rustls = { package = "rustls", version = "0.20.0" }
|
||||||
|
zstd = "0.9"
|
||||||
|
|
||||||
|
[[test]]
|
||||||
|
name = "test_server"
|
||||||
|
required-features = ["compress-brotli", "compress-gzip", "compress-zstd", "cookies"]
|
||||||
|
|
||||||
|
[[test]]
|
||||||
|
name = "compression"
|
||||||
|
required-features = ["compress-brotli", "compress-gzip", "compress-zstd"]
|
||||||
|
|
||||||
|
[[example]]
|
||||||
|
name = "basic"
|
||||||
|
required-features = ["compress-gzip"]
|
||||||
|
|
||||||
|
[[example]]
|
||||||
|
name = "uds"
|
||||||
|
required-features = ["compress-gzip"]
|
||||||
|
|
||||||
|
[[example]]
|
||||||
|
name = "on-connect"
|
||||||
|
required-features = []
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "server"
|
||||||
|
harness = false
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "service"
|
||||||
|
harness = false
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "responder"
|
||||||
|
harness = false
|
1
actix-web/LICENSE-APACHE
Symbolic link
1
actix-web/LICENSE-APACHE
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../LICENSE-APACHE
|
1
actix-web/LICENSE-MIT
Symbolic link
1
actix-web/LICENSE-MIT
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../LICENSE-MIT
|
105
actix-web/README.md
Normal file
105
actix-web/README.md
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
<div align="center">
|
||||||
|
<h1>Actix Web</h1>
|
||||||
|
<p>
|
||||||
|
<strong>Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust</strong>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
[![crates.io](https://img.shields.io/crates/v/actix-web?label=latest)](https://crates.io/crates/actix-web)
|
||||||
|
[![Documentation](https://docs.rs/actix-web/badge.svg?version=4.0.0-rc.1)](https://docs.rs/actix-web/4.0.0-rc.1)
|
||||||
|
![MSRV](https://img.shields.io/badge/rustc-1.54+-ab6000.svg)
|
||||||
|
![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-web.svg)
|
||||||
|
[![Dependency Status](https://deps.rs/crate/actix-web/4.0.0-rc.1/status.svg)](https://deps.rs/crate/actix-web/4.0.0-rc.1)
|
||||||
|
<br />
|
||||||
|
[![CI](https://github.com/actix/actix-web/actions/workflows/ci.yml/badge.svg)](https://github.com/actix/actix-web/actions/workflows/ci.yml)
|
||||||
|
[![codecov](https://codecov.io/gh/actix/actix-web/branch/master/graph/badge.svg)](https://codecov.io/gh/actix/actix-web)
|
||||||
|
![downloads](https://img.shields.io/crates/d/actix-web.svg)
|
||||||
|
[![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/NWpN5mmg3x)
|
||||||
|
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Supports _HTTP/1.x_ and _HTTP/2_
|
||||||
|
- Streaming and pipelining
|
||||||
|
- Powerful [request routing](https://actix.rs/docs/url-dispatch/) with optional macros
|
||||||
|
- Full [Tokio](https://tokio.rs) compatibility
|
||||||
|
- Keep-alive and slow requests handling
|
||||||
|
- Client/server [WebSockets](https://actix.rs/docs/websockets/) support
|
||||||
|
- Transparent content compression/decompression (br, gzip, deflate, zstd)
|
||||||
|
- Multipart streams
|
||||||
|
- Static assets
|
||||||
|
- SSL support using OpenSSL or Rustls
|
||||||
|
- Middlewares ([Logger, Session, CORS, etc](https://actix.rs/docs/middleware/))
|
||||||
|
- Includes an async [HTTP client](https://docs.rs/awc/)
|
||||||
|
- Runs on stable Rust 1.54+
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
- [Website & User Guide](https://actix.rs)
|
||||||
|
- [Examples Repository](https://github.com/actix/examples)
|
||||||
|
- [API Documentation](https://docs.rs/actix-web)
|
||||||
|
- [API Documentation (master branch)](https://actix.rs/actix-web/actix_web)
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
Dependencies:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
actix-web = "4.0.0-rc.1"
|
||||||
|
```
|
||||||
|
|
||||||
|
Code:
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use actix_web::{get, web, App, HttpServer, Responder};
|
||||||
|
|
||||||
|
#[get("/{id}/{name}/index.html")]
|
||||||
|
async fn index(params: web::Path<(u32, String)>) -> impl Responder {
|
||||||
|
let (id, name) = params.into_inner();
|
||||||
|
format!("Hello {}! id:{}", name, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[actix_web::main] // or #[tokio::main]
|
||||||
|
async fn main() -> std::io::Result<()> {
|
||||||
|
HttpServer::new(|| App::new().service(index))
|
||||||
|
.bind(("127.0.0.1", 8080))?
|
||||||
|
.run()
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### More examples
|
||||||
|
|
||||||
|
- [Basic Setup](https://github.com/actix/examples/tree/master/basics/basics/)
|
||||||
|
- [Application State](https://github.com/actix/examples/tree/master/basics/state/)
|
||||||
|
- [JSON Handling](https://github.com/actix/examples/tree/master/json/json/)
|
||||||
|
- [Multipart Streams](https://github.com/actix/examples/tree/master/forms/multipart/)
|
||||||
|
- [Diesel Integration](https://github.com/actix/examples/tree/master/database_interactions/diesel/)
|
||||||
|
- [r2d2 Integration](https://github.com/actix/examples/tree/master/database_interactions/r2d2/)
|
||||||
|
- [Simple WebSocket](https://github.com/actix/examples/tree/master/websockets/websocket/)
|
||||||
|
- [Tera Templates](https://github.com/actix/examples/tree/master/template_engines/tera/)
|
||||||
|
- [Askama Templates](https://github.com/actix/examples/tree/master/template_engines/askama/)
|
||||||
|
- [HTTPS using Rustls](https://github.com/actix/examples/tree/master/security/rustls/)
|
||||||
|
- [HTTPS using OpenSSL](https://github.com/actix/examples/tree/master/security/openssl/)
|
||||||
|
- [WebSocket Chat](https://github.com/actix/examples/tree/master/websockets/chat/)
|
||||||
|
|
||||||
|
You may consider checking out [this directory](https://github.com/actix/examples/tree/master/) for more examples.
|
||||||
|
|
||||||
|
## Benchmarks
|
||||||
|
|
||||||
|
One of the fastest web frameworks available according to the [TechEmpower Framework Benchmark](https://www.techempower.com/benchmarks/#section=data-r20&test=composite).
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This project is licensed under either of the following licenses, at your option:
|
||||||
|
|
||||||
|
- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or [http://www.apache.org/licenses/LICENSE-2.0])
|
||||||
|
- MIT license ([LICENSE-MIT](LICENSE-MIT) or [http://opensource.org/licenses/MIT])
|
||||||
|
|
||||||
|
## Code of Conduct
|
||||||
|
|
||||||
|
Contribution to the actix-web repo is organized under the terms of the Contributor Covenant.
|
||||||
|
The Actix team promises to intervene to uphold that code of conduct.
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user