mirror of
https://github.com/actix/examples
synced 2024-11-23 22:41:07 +01:00
standardize examples
This commit is contained in:
parent
ca6eaee52e
commit
6424e4e023
385
Cargo.lock
generated
385
Cargo.lock
generated
@ -70,7 +70,7 @@ version = "1.0.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"casbin",
|
"casbin",
|
||||||
"loge",
|
"env_logger",
|
||||||
"tokio 1.26.0",
|
"tokio 1.26.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -788,23 +788,30 @@ checksum = "71938f30533e4d95a6d17aa530939da3842c2ab6f4f84b9dae68447e4129f74a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "askama"
|
name = "askama"
|
||||||
version = "0.11.1"
|
version = "0.12.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fb98f10f371286b177db5eeb9a6e5396609555686a35e1d4f7b9a9c6d8af0139"
|
checksum = "47cbc3cf73fa8d9833727bbee4835ba5c421a0d65b72daf9a7b5d0e0f9cfb57e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"askama_derive",
|
"askama_derive",
|
||||||
"askama_escape",
|
"askama_escape",
|
||||||
"askama_shared",
|
"humansize",
|
||||||
|
"num-traits",
|
||||||
|
"percent-encoding",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "askama_derive"
|
name = "askama_derive"
|
||||||
version = "0.11.2"
|
version = "0.12.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "87bf87e6e8b47264efa9bde63d6225c6276a52e05e91bf37eaa8afd0032d6b71"
|
checksum = "e80b5ad1afe82872b7aa3e9de9b206ecb85584aa324f0f60fa4c903ce935936b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"askama_shared",
|
"basic-toml",
|
||||||
|
"mime",
|
||||||
|
"mime_guess",
|
||||||
|
"nom",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"serde",
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -814,26 +821,6 @@ version = "0.10.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341"
|
checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "askama_shared"
|
|
||||||
version = "0.12.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bf722b94118a07fcbc6640190f247334027685d4e218b794dbfe17c32bf38ed0"
|
|
||||||
dependencies = [
|
|
||||||
"askama_escape",
|
|
||||||
"humansize",
|
|
||||||
"mime",
|
|
||||||
"mime_guess",
|
|
||||||
"nom",
|
|
||||||
"num-traits",
|
|
||||||
"percent-encoding",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"serde",
|
|
||||||
"syn",
|
|
||||||
"toml",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "assert-json-diff"
|
name = "assert-json-diff"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
@ -1019,26 +1006,6 @@ dependencies = [
|
|||||||
"tokio-postgres",
|
"tokio-postgres",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "atoi"
|
|
||||||
version = "1.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d7c57d12312ff59c811c0643f4d80830505833c9ffaebd193d819392b265be8e"
|
|
||||||
dependencies = [
|
|
||||||
"num-traits",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "atty"
|
|
||||||
version = "0.2.14"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
|
||||||
dependencies = [
|
|
||||||
"hermit-abi 0.1.19",
|
|
||||||
"libc",
|
|
||||||
"winapi 0.3.9",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
@ -1532,6 +1499,15 @@ dependencies = [
|
|||||||
"vsimd",
|
"vsimd",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "basic-toml"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5c0de75129aa8d0cceaf750b89013f0e08804d6ec61416da787b35ad0d7cddf1"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "basics"
|
name = "basics"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
@ -1881,24 +1857,24 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono-tz"
|
name = "chrono-tz"
|
||||||
version = "0.6.3"
|
version = "0.6.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "29c39203181991a7dd4343b8005bd804e7a9a37afb8ac070e43771e8c820bbde"
|
checksum = "58549f1842da3080ce63002102d5bc954c7bc843d4f47818e642abdc36253552"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"chrono-tz-build",
|
"chrono-tz-build",
|
||||||
"phf 0.11.1",
|
"phf 0.10.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono-tz-build"
|
name = "chrono-tz-build"
|
||||||
version = "0.0.3"
|
version = "0.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6f509c3a87b33437b05e2458750a0700e5bdd6956176773e6c7d6dd15a283a0c"
|
checksum = "db058d493fb2f65f41861bfed7e3fe6335264a9f0f92710cab5bdf01fef09069"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"parse-zoneinfo",
|
"parse-zoneinfo",
|
||||||
"phf 0.11.1",
|
"phf 0.10.1",
|
||||||
"phf_codegen 0.11.1",
|
"phf_codegen",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1993,17 +1969,6 @@ dependencies = [
|
|||||||
"unicode-width",
|
"unicode-width",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "colored"
|
|
||||||
version = "1.9.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f4ffc801dacf156c5854b9df4f425a626539c3a6ef7893cc0c5084a23f0b6c59"
|
|
||||||
dependencies = [
|
|
||||||
"atty",
|
|
||||||
"lazy_static",
|
|
||||||
"winapi 0.3.9",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "combine"
|
name = "combine"
|
||||||
version = "3.8.1"
|
version = "3.8.1"
|
||||||
@ -2198,21 +2163,6 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "crc"
|
|
||||||
version = "3.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe"
|
|
||||||
dependencies = [
|
|
||||||
"crc-catalog",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "crc-catalog"
|
|
||||||
version = "2.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crc32c"
|
name = "crc32c"
|
||||||
version = "0.6.3"
|
version = "0.6.3"
|
||||||
@ -2742,12 +2692,6 @@ version = "0.15.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
|
checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dotenvy"
|
|
||||||
version = "0.15.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "03d8c417d7a8cb362e0c37e5d815f5eb7c37f79ff93707329d5a194e42e54ca0"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dtoa"
|
name = "dtoa"
|
||||||
version = "1.0.6"
|
version = "1.0.6"
|
||||||
@ -2759,9 +2703,6 @@ name = "either"
|
|||||||
version = "1.8.1"
|
version = "1.8.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
|
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "encoding_rs"
|
name = "encoding_rs"
|
||||||
@ -2990,9 +2931,6 @@ version = "0.10.14"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577"
|
checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-core",
|
|
||||||
"futures-sink",
|
|
||||||
"pin-project",
|
|
||||||
"spin 0.9.6",
|
"spin 0.9.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -3198,17 +3136,6 @@ dependencies = [
|
|||||||
"futures-util",
|
"futures-util",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "futures-intrusive"
|
|
||||||
version = "0.4.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a604f7a68fbf8103337523b1fadc8ade7361ee3f112f7c680ad179651616aed5"
|
|
||||||
dependencies = [
|
|
||||||
"futures-core",
|
|
||||||
"lock_api 0.4.9",
|
|
||||||
"parking_lot 0.11.2",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-io"
|
name = "futures-io"
|
||||||
version = "0.3.27"
|
version = "0.3.27"
|
||||||
@ -3435,23 +3362,11 @@ dependencies = [
|
|||||||
"hashbrown 0.11.2",
|
"hashbrown 0.11.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hashlink"
|
|
||||||
version = "0.8.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "69fe1fcf8b4278d860ad0548329f892a3631fb63f82574df68275f34cdbe0ffa"
|
|
||||||
dependencies = [
|
|
||||||
"hashbrown 0.12.3",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heck"
|
name = "heck"
|
||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||||
dependencies = [
|
|
||||||
"unicode-segmentation",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hello-world"
|
name = "hello-world"
|
||||||
@ -3459,15 +3374,7 @@ version = "1.0.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
]
|
"log",
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hermit-abi"
|
|
||||||
version = "0.1.19"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -3603,9 +3510,12 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "humansize"
|
name = "humansize"
|
||||||
version = "1.1.1"
|
version = "2.1.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "02296996cb8796d7c6e3bc2d9211b7802812d36999a51bb754123ead7d37d026"
|
checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7"
|
||||||
|
dependencies = [
|
||||||
|
"libm",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "humantime"
|
name = "humantime"
|
||||||
@ -4237,13 +4147,18 @@ dependencies = [
|
|||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libm"
|
||||||
|
version = "0.2.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libsqlite3-sys"
|
name = "libsqlite3-sys"
|
||||||
version = "0.24.2"
|
version = "0.24.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "898745e570c7d0453cc1fbc4a701eb6c662ed54e8fec8b7d14be137ebeeb9d14"
|
checksum = "898745e570c7d0453cc1fbc4a701eb6c662ed54e8fec8b7d14be137ebeeb9d14"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
"vcpkg",
|
"vcpkg",
|
||||||
]
|
]
|
||||||
@ -4326,19 +4241,6 @@ dependencies = [
|
|||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "loge"
|
|
||||||
version = "0.4.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "dc44e963910d60dbd093f090cb56c6cec463f5b23c07a130097deef8fe854c4b"
|
|
||||||
dependencies = [
|
|
||||||
"atty",
|
|
||||||
"chrono",
|
|
||||||
"colored",
|
|
||||||
"log",
|
|
||||||
"winapi 0.3.9",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lru"
|
name = "lru"
|
||||||
version = "0.8.1"
|
version = "0.8.1"
|
||||||
@ -4371,7 +4273,7 @@ checksum = "7a2629bb1404f3d34c2e921f21fd34ba00b206124c81f65c50b43b6aaefeb016"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"phf 0.10.1",
|
"phf 0.10.1",
|
||||||
"phf_codegen 0.10.0",
|
"phf_codegen",
|
||||||
"string_cache",
|
"string_cache",
|
||||||
"string_cache_codegen",
|
"string_cache_codegen",
|
||||||
"tendril",
|
"tendril",
|
||||||
@ -4448,7 +4350,7 @@ dependencies = [
|
|||||||
"actix-web",
|
"actix-web",
|
||||||
"actix-web-lab",
|
"actix-web-lab",
|
||||||
"aes-gcm-siv",
|
"aes-gcm-siv",
|
||||||
"base64 0.20.0",
|
"base64 0.21.0",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"log",
|
"log",
|
||||||
@ -4510,9 +4412,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "minijinja"
|
name = "minijinja"
|
||||||
version = "0.28.0"
|
version = "0.30.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ea571551ee271bbed113dc8e82fce0131a0c80f2f7656c31e0e47594339d4037"
|
checksum = "650266e616c4634fd6c188a410886e8700689fe78197f54d194a9ed560863f94"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memo-map",
|
"memo-map",
|
||||||
"self_cell",
|
"self_cell",
|
||||||
@ -4521,9 +4423,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "minijinja-autoreload"
|
name = "minijinja-autoreload"
|
||||||
version = "0.28.0"
|
version = "0.30.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "522076c0a122672d46a1b96c9c56cb36e6b6b72222f5246ffe0a2eb5f9a0093e"
|
checksum = "9c53f321aea5d295c51d53ed6654a25256f2feed430664790d6dd46f90e8cd84"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"minijinja",
|
"minijinja",
|
||||||
"notify",
|
"notify",
|
||||||
@ -4930,15 +4832,6 @@ dependencies = [
|
|||||||
"reqwest 0.11.14",
|
"reqwest 0.11.14",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "openssl-example"
|
|
||||||
version = "1.0.0"
|
|
||||||
dependencies = [
|
|
||||||
"actix-web",
|
|
||||||
"env_logger",
|
|
||||||
"openssl",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl-macros"
|
name = "openssl-macros"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@ -5199,20 +5092,10 @@ version = "0.10.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd"
|
checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"phf_generator 0.10.0",
|
"phf_generator",
|
||||||
"phf_shared 0.10.0",
|
"phf_shared 0.10.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "phf_codegen"
|
|
||||||
version = "0.11.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a56ac890c5e3ca598bbdeaa99964edb5b0258a583a9eb6ef4e89fc85d9224770"
|
|
||||||
dependencies = [
|
|
||||||
"phf_generator 0.11.1",
|
|
||||||
"phf_shared 0.11.1",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "phf_generator"
|
name = "phf_generator"
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
@ -5223,16 +5106,6 @@ dependencies = [
|
|||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "phf_generator"
|
|
||||||
version = "0.11.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b1181c94580fa345f50f19d738aaa39c0ed30a600d95cb2d3e23f94266f14fbf"
|
|
||||||
dependencies = [
|
|
||||||
"phf_shared 0.11.1",
|
|
||||||
"rand 0.8.5",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "phf_shared"
|
name = "phf_shared"
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
@ -5240,6 +5113,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096"
|
checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"siphasher",
|
"siphasher",
|
||||||
|
"uncased",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -5249,7 +5123,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "e1fb5f6f826b772a8d4c0394209441e7d37cbbb967ae9c7e0e8134365c9ee676"
|
checksum = "e1fb5f6f826b772a8d4c0394209441e7d37cbbb967ae9c7e0e8134365c9ee676"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"siphasher",
|
"siphasher",
|
||||||
"uncased",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -5952,7 +5825,7 @@ dependencies = [
|
|||||||
"bitflags",
|
"bitflags",
|
||||||
"fallible-iterator",
|
"fallible-iterator",
|
||||||
"fallible-streaming-iterator",
|
"fallible-streaming-iterator",
|
||||||
"hashlink 0.7.0",
|
"hashlink",
|
||||||
"libsqlite3-sys",
|
"libsqlite3-sys",
|
||||||
"memchr",
|
"memchr",
|
||||||
"smallvec 1.10.0",
|
"smallvec 1.10.0",
|
||||||
@ -6131,9 +6004,9 @@ checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sailfish"
|
name = "sailfish"
|
||||||
version = "0.5.0"
|
version = "0.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "79aef0b4612749106d372dfdeee715082f2f0fe24263be08e19db9b00b694bf9"
|
checksum = "dd1369644089e936dea5df0d6201636e2b6eb2e9ad098efb2eca5606ece3fab7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoap",
|
"itoap",
|
||||||
"ryu",
|
"ryu",
|
||||||
@ -6143,9 +6016,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sailfish-compiler"
|
name = "sailfish-compiler"
|
||||||
version = "0.5.0"
|
version = "0.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "787ef14715822299715d98d6eb6157f03a57a5258ffbd3321847f7450853dd64"
|
checksum = "761019f0de360c654d51e068f07acfa8677e9566391ca290e1ab7c53a55d8d02"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"filetime",
|
"filetime",
|
||||||
"home",
|
"home",
|
||||||
@ -6159,9 +6032,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sailfish-macros"
|
name = "sailfish-macros"
|
||||||
version = "0.5.0"
|
version = "0.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d0d39ce164c9e19147bcc4fa9ce9dcfc0a451e6cd0a996bb896fc7dee92887a4"
|
checksum = "dad9a1a51d085aa939115cf537c71b1e438de7d27363a039ce525bf393262303"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"sailfish-compiler",
|
"sailfish-compiler",
|
||||||
@ -6502,6 +6375,7 @@ dependencies = [
|
|||||||
"diesel",
|
"diesel",
|
||||||
"dotenv",
|
"dotenv",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
"log",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"r2d2",
|
"r2d2",
|
||||||
"rust-argon2",
|
"rust-argon2",
|
||||||
@ -6637,107 +6511,6 @@ dependencies = [
|
|||||||
"lock_api 0.4.9",
|
"lock_api 0.4.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "sqlformat"
|
|
||||||
version = "0.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0c12bc9199d1db8234678b7051747c07f517cdcf019262d1847b94ec8b1aee3e"
|
|
||||||
dependencies = [
|
|
||||||
"itertools",
|
|
||||||
"nom",
|
|
||||||
"unicode_categories",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "sqlx"
|
|
||||||
version = "0.6.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9249290c05928352f71c077cc44a464d880c63f26f7534728cca008e135c0428"
|
|
||||||
dependencies = [
|
|
||||||
"sqlx-core",
|
|
||||||
"sqlx-macros",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "sqlx-core"
|
|
||||||
version = "0.6.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "dcbc16ddba161afc99e14d1713a453747a2b07fc097d2009f4c300ec99286105"
|
|
||||||
dependencies = [
|
|
||||||
"ahash 0.7.6",
|
|
||||||
"atoi",
|
|
||||||
"bitflags",
|
|
||||||
"byteorder",
|
|
||||||
"bytes 1.4.0",
|
|
||||||
"crc",
|
|
||||||
"crossbeam-queue 0.3.8",
|
|
||||||
"dotenvy",
|
|
||||||
"either",
|
|
||||||
"event-listener",
|
|
||||||
"flume",
|
|
||||||
"futures-channel",
|
|
||||||
"futures-core",
|
|
||||||
"futures-executor",
|
|
||||||
"futures-intrusive",
|
|
||||||
"futures-util",
|
|
||||||
"hashlink 0.8.1",
|
|
||||||
"hex",
|
|
||||||
"indexmap",
|
|
||||||
"itoa 1.0.6",
|
|
||||||
"libc",
|
|
||||||
"libsqlite3-sys",
|
|
||||||
"log",
|
|
||||||
"memchr",
|
|
||||||
"once_cell",
|
|
||||||
"paste",
|
|
||||||
"percent-encoding",
|
|
||||||
"rustls 0.20.8",
|
|
||||||
"rustls-pemfile",
|
|
||||||
"serde",
|
|
||||||
"sha2",
|
|
||||||
"smallvec 1.10.0",
|
|
||||||
"sqlformat",
|
|
||||||
"sqlx-rt",
|
|
||||||
"stringprep",
|
|
||||||
"thiserror",
|
|
||||||
"tokio-stream",
|
|
||||||
"url",
|
|
||||||
"webpki-roots 0.22.6",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "sqlx-macros"
|
|
||||||
version = "0.6.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b850fa514dc11f2ee85be9d055c512aa866746adfacd1cb42d867d68e6a5b0d9"
|
|
||||||
dependencies = [
|
|
||||||
"dotenvy",
|
|
||||||
"either",
|
|
||||||
"heck",
|
|
||||||
"hex",
|
|
||||||
"once_cell",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"sha2",
|
|
||||||
"sqlx-core",
|
|
||||||
"sqlx-rt",
|
|
||||||
"syn",
|
|
||||||
"url",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "sqlx-rt"
|
|
||||||
version = "0.6.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "24c5b2d25fa654cc5f841750b8e1cdedbe21189bf9a9382ee90bfa9dd3562396"
|
|
||||||
dependencies = [
|
|
||||||
"once_cell",
|
|
||||||
"tokio 1.26.0",
|
|
||||||
"tokio-rustls",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "standback"
|
name = "standback"
|
||||||
version = "0.2.17"
|
version = "0.2.17"
|
||||||
@ -6753,6 +6526,7 @@ version = "1.0.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
"log",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -6840,7 +6614,7 @@ version = "0.5.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988"
|
checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"phf_generator 0.10.0",
|
"phf_generator",
|
||||||
"phf_shared 0.10.0",
|
"phf_shared 0.10.0",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -6941,8 +6715,10 @@ name = "templating-askama"
|
|||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
|
"actix-web-lab",
|
||||||
"askama",
|
"askama",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
"log",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -6997,6 +6773,7 @@ dependencies = [
|
|||||||
"actix-web",
|
"actix-web",
|
||||||
"actix-web-lab",
|
"actix-web-lab",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
"log",
|
||||||
"tera",
|
"tera",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -7006,6 +6783,7 @@ version = "1.0.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
"log",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"tinytemplate",
|
"tinytemplate",
|
||||||
]
|
]
|
||||||
@ -7017,6 +6795,7 @@ dependencies = [
|
|||||||
"actix-web",
|
"actix-web",
|
||||||
"derive_more",
|
"derive_more",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
"log",
|
||||||
"yarte",
|
"yarte",
|
||||||
"yarte_helpers",
|
"yarte_helpers",
|
||||||
]
|
]
|
||||||
@ -7034,9 +6813,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tera"
|
name = "tera"
|
||||||
version = "1.17.1"
|
version = "1.18.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3df578c295f9ec044ff1c829daf31bb7581d5b3c2a7a3d87419afe1f2531438c"
|
checksum = "27df4164dd125228af4c90c9799a29740e39151767d579f3fc711491054a0378"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"chrono-tz",
|
"chrono-tz",
|
||||||
@ -7051,6 +6830,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"slug",
|
"slug",
|
||||||
|
"thread_local",
|
||||||
"unic-segment",
|
"unic-segment",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -7085,11 +6865,10 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thread_local"
|
name = "thread_local"
|
||||||
version = "1.1.7"
|
version = "1.1.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
|
checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
|
||||||
"once_cell",
|
"once_cell",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -7213,20 +6992,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "todo"
|
name = "tls-openssl"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-files",
|
|
||||||
"actix-session",
|
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"actix-web-lab",
|
|
||||||
"dotenv",
|
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"log",
|
"log",
|
||||||
"serde",
|
"openssl",
|
||||||
"serde_json",
|
|
||||||
"sqlx",
|
|
||||||
"tera",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -7912,12 +7684,6 @@ dependencies = [
|
|||||||
"tinyvec",
|
"tinyvec",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-segmentation"
|
|
||||||
version = "1.10.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-width"
|
name = "unicode-width"
|
||||||
version = "0.1.10"
|
version = "0.1.10"
|
||||||
@ -7930,12 +7696,6 @@ version = "0.2.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
|
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode_categories"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "universal-hash"
|
name = "universal-hash"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
@ -7952,6 +7712,7 @@ version = "1.0.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
"log",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -12,7 +12,7 @@ members = [
|
|||||||
"basics/nested-routing",
|
"basics/nested-routing",
|
||||||
"basics/state",
|
"basics/state",
|
||||||
"basics/static-files",
|
"basics/static-files",
|
||||||
"basics/todo",
|
# "basics/todo",
|
||||||
"cors/backend",
|
"cors/backend",
|
||||||
"data-factory",
|
"data-factory",
|
||||||
"databases/diesel",
|
"databases/diesel",
|
||||||
|
@ -5,6 +5,7 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web.workspace = true
|
actix-web.workspace = true
|
||||||
|
|
||||||
casbin = "2"
|
casbin = "2"
|
||||||
loge = { version = "0.4", default-features = false, features = ["colored", "chrono"] }
|
env_logger.workspace = true
|
||||||
tokio = { workspace = true, features = ["sync"] }
|
tokio.workspace = true
|
||||||
|
@ -23,10 +23,7 @@ async fn fail(enforcer: web::Data<RwLock<Enforcer>>, req: HttpRequest) -> HttpRe
|
|||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> io::Result<()> {
|
async fn main() -> io::Result<()> {
|
||||||
std::env::set_var("RUST_LOG", "info");
|
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||||
std::env::set_var("LOGE_FORMAT", "target");
|
|
||||||
|
|
||||||
loge::init();
|
|
||||||
|
|
||||||
let model = DefaultModel::from_file("rbac/rbac_model.conf")
|
let model = DefaultModel::from_file("rbac/rbac_model.conf")
|
||||||
.await
|
.await
|
||||||
|
@ -33,9 +33,9 @@ async fn index(session: Session, req: HttpRequest) -> Result<&'static str> {
|
|||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
std::env::set_var("RUST_LOG", "info");
|
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||||
env_logger::init();
|
|
||||||
log::info!("Starting http server: 127.0.0.1:8080");
|
log::info!("starting HTTP server at http://localhost:8080");
|
||||||
|
|
||||||
HttpServer::new(|| {
|
HttpServer::new(|| {
|
||||||
App::new()
|
App::new()
|
||||||
|
@ -4,20 +4,21 @@ version = "1.0.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web.workspace = true
|
|
||||||
actix-identity.workspace = true
|
actix-identity.workspace = true
|
||||||
actix-session = { workspace = true, features = ["cookie-session"] }
|
actix-session = { workspace = true, features = ["cookie-session"] }
|
||||||
|
actix-web.workspace = true
|
||||||
|
|
||||||
chrono = { version = "0.4.20", features = ["serde"] }
|
chrono = { version = "0.4.20", features = ["serde"] }
|
||||||
derive_more.workspace = true
|
derive_more.workspace = true
|
||||||
diesel = { version = "2", features = ["postgres", "r2d2", "uuid", "chrono"] }
|
diesel = { version = "2", features = ["postgres", "r2d2", "uuid", "chrono"] }
|
||||||
dotenv = "0.15"
|
dotenv = "0.15"
|
||||||
env_logger.workspace = true
|
env_logger.workspace = true
|
||||||
|
log = "0.4"
|
||||||
once_cell = "1"
|
once_cell = "1"
|
||||||
r2d2 = "0.8"
|
r2d2 = "0.8"
|
||||||
rust-argon2 = "1"
|
rust-argon2 = "1"
|
||||||
serde.workspace = true
|
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
|
serde.workspace = true
|
||||||
sparkpost = "0.5"
|
sparkpost = "0.5"
|
||||||
uuid = { version = "1", features = ["v4", "serde"] }
|
|
||||||
time = "0.3"
|
time = "0.3"
|
||||||
|
uuid = { version = "1", features = ["v4", "serde"] }
|
||||||
|
@ -4,10 +4,7 @@ extern crate diesel;
|
|||||||
use actix_identity::IdentityMiddleware;
|
use actix_identity::IdentityMiddleware;
|
||||||
use actix_session::{config::PersistentSession, storage::CookieSessionStore, SessionMiddleware};
|
use actix_session::{config::PersistentSession, storage::CookieSessionStore, SessionMiddleware};
|
||||||
use actix_web::{cookie::Key, middleware, web, App, HttpServer};
|
use actix_web::{cookie::Key, middleware, web, App, HttpServer};
|
||||||
use diesel::{
|
use diesel::{prelude::*, r2d2};
|
||||||
prelude::*,
|
|
||||||
r2d2::{self, ConnectionManager},
|
|
||||||
};
|
|
||||||
use time::Duration;
|
use time::Duration;
|
||||||
|
|
||||||
mod auth_handler;
|
mod auth_handler;
|
||||||
@ -22,21 +19,19 @@ mod utils;
|
|||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
dotenv::dotenv().ok();
|
dotenv::dotenv().ok();
|
||||||
std::env::set_var(
|
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||||
"RUST_LOG",
|
|
||||||
"simple-auth-server=debug,actix_web=info,actix_server=info",
|
|
||||||
);
|
|
||||||
env_logger::init();
|
|
||||||
let database_url = std::env::var("DATABASE_URL").expect("DATABASE_URL must be set");
|
let database_url = std::env::var("DATABASE_URL").expect("DATABASE_URL must be set");
|
||||||
|
|
||||||
// create db connection pool
|
// create db connection pool
|
||||||
let manager = ConnectionManager::<PgConnection>::new(database_url);
|
let manager = r2d2::ConnectionManager::<PgConnection>::new(database_url);
|
||||||
let pool: models::Pool = r2d2::Pool::builder()
|
let pool: models::Pool = r2d2::Pool::builder()
|
||||||
.build(manager)
|
.build(manager)
|
||||||
.expect("Failed to create pool.");
|
.expect("Failed to create pool.");
|
||||||
let domain: String = std::env::var("DOMAIN").unwrap_or_else(|_| "localhost".to_string());
|
let domain: String = std::env::var("DOMAIN").unwrap_or_else(|_| "localhost".to_string());
|
||||||
|
|
||||||
// Start http server
|
log::info!("starting HTTP server at http://localhost:8080");
|
||||||
|
|
||||||
HttpServer::new(move || {
|
HttpServer::new(move || {
|
||||||
App::new()
|
App::new()
|
||||||
.app_data(web::Data::new(pool.clone()))
|
.app_data(web::Data::new(pool.clone()))
|
||||||
|
@ -6,3 +6,4 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web.workspace = true
|
actix-web.workspace = true
|
||||||
env_logger.workspace = true
|
env_logger.workspace = true
|
||||||
|
log.workspace = true
|
||||||
|
@ -7,8 +7,9 @@ async fn index(req: HttpRequest) -> &'static str {
|
|||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
std::env::set_var("RUST_LOG", "actix_web=info");
|
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||||
env_logger::init();
|
|
||||||
|
log::info!("starting HTTP server at http://localhost:8080");
|
||||||
|
|
||||||
HttpServer::new(|| {
|
HttpServer::new(|| {
|
||||||
App::new()
|
App::new()
|
||||||
|
@ -6,3 +6,4 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web.workspace = true
|
actix-web.workspace = true
|
||||||
env_logger.workspace = true
|
env_logger.workspace = true
|
||||||
|
log.workspace = true
|
||||||
|
@ -58,14 +58,15 @@ async fn index(
|
|||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> io::Result<()> {
|
async fn main() -> io::Result<()> {
|
||||||
std::env::set_var("RUST_LOG", "actix_web=info");
|
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||||
env_logger::init();
|
|
||||||
|
|
||||||
// Create some global state prior to building the server
|
// Create some global state prior to building the server
|
||||||
#[allow(clippy::mutex_atomic)] // it's intentional.
|
#[allow(clippy::mutex_atomic)] // it's intentional.
|
||||||
let counter_mutex = Data::new(Mutex::new(0usize));
|
let counter_mutex = Data::new(Mutex::new(0usize));
|
||||||
let counter_atomic = Data::new(AtomicUsize::new(0usize));
|
let counter_atomic = Data::new(AtomicUsize::new(0usize));
|
||||||
|
|
||||||
|
log::info!("starting HTTP server at http://localhost:8080");
|
||||||
|
|
||||||
// move is necessary to give closure below ownership of counter1
|
// move is necessary to give closure below ownership of counter1
|
||||||
HttpServer::new(move || {
|
HttpServer::new(move || {
|
||||||
// Create some thread-local state
|
// Create some thread-local state
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "openssl-example"
|
name = "tls-openssl"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = { workspace = true, features = ["openssl"] }
|
actix-web = { workspace = true, features = ["openssl"] }
|
||||||
env_logger.workspace = true
|
env_logger.workspace = true
|
||||||
|
log.workspace = true
|
||||||
openssl = "0.10"
|
openssl = "0.10"
|
||||||
|
@ -13,10 +13,7 @@ async fn index(req: HttpRequest) -> Result<HttpResponse, Error> {
|
|||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> io::Result<()> {
|
async fn main() -> io::Result<()> {
|
||||||
std::env::set_var("RUST_LOG", "actix_web=debug");
|
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||||
env_logger::init();
|
|
||||||
|
|
||||||
println!("Started http server: https://127.0.0.1:8443");
|
|
||||||
|
|
||||||
// load TLS keys
|
// load TLS keys
|
||||||
let mut builder = SslAcceptor::mozilla_intermediate(SslMethod::tls()).unwrap();
|
let mut builder = SslAcceptor::mozilla_intermediate(SslMethod::tls()).unwrap();
|
||||||
@ -25,6 +22,8 @@ async fn main() -> io::Result<()> {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
builder.set_certificate_chain_file("cert.pem").unwrap();
|
builder.set_certificate_chain_file("cert.pem").unwrap();
|
||||||
|
|
||||||
|
log::info!("starting HTTPS server at http://localhost:8443");
|
||||||
|
|
||||||
HttpServer::new(|| {
|
HttpServer::new(|| {
|
||||||
App::new()
|
App::new()
|
||||||
// enable logger
|
// enable logger
|
||||||
|
@ -139,11 +139,12 @@ impl AppState {
|
|||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
std::env::set_var("RUST_LOG", "info");
|
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||||
env_logger::init();
|
|
||||||
|
|
||||||
let network = Arc::new(RwLock::new(ObjNetwork::new()));
|
let network = Arc::new(RwLock::new(ObjNetwork::new()));
|
||||||
|
|
||||||
|
log::info!("starting HTTP server at http://localhost:8080");
|
||||||
|
|
||||||
HttpServer::new(move || {
|
HttpServer::new(move || {
|
||||||
let app_state = AppState::new(network.clone());
|
let app_state = AppState::new(network.clone());
|
||||||
App::new()
|
App::new()
|
||||||
|
@ -9,7 +9,7 @@ actix-web.workspace = true
|
|||||||
actix-web-lab.workspace = true
|
actix-web-lab.workspace = true
|
||||||
|
|
||||||
aes-gcm-siv = "0.11"
|
aes-gcm-siv = "0.11"
|
||||||
base64 = "0.20"
|
base64 = "0.21"
|
||||||
env_logger.workspace = true
|
env_logger.workspace = true
|
||||||
futures-util.workspace = true
|
futures-util.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
|
@ -14,10 +14,11 @@ All this to say, it provides a (fairly brittle) way to have handlers not need to
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
Using [HTTPie] throughout for simplicity.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ http POST :8080/encrypt id:=1234 data=abcde > tmp.json
|
$ http POST :8080/encrypt id:=1234 data=abcde > tmp.json
|
||||||
POST /reverse HTTP/1.1
|
HTTP/1.1 200 OK
|
||||||
Content-Length: 76
|
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -28,7 +29,6 @@ Content-Type: application/json
|
|||||||
|
|
||||||
$ cat tmp.json | http -v POST :8080/reverse
|
$ cat tmp.json | http -v POST :8080/reverse
|
||||||
HTTP/1.1 200 OK
|
HTTP/1.1 200 OK
|
||||||
Content-Length: 66
|
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -49,3 +49,5 @@ The server logs would look something like
|
|||||||
[INFO middleware_encrypted_payloads] encrypting response 1234
|
[INFO middleware_encrypted_payloads] encrypting response 1234
|
||||||
[INFO actix_web::middleware::logger] 127.0.0.1 "POST /reverse HTTP/1.1" 200 66 "-" "-" 0.000425
|
[INFO actix_web::middleware::logger] 127.0.0.1 "POST /reverse HTTP/1.1" 200 66 "-" "-" 0.000425
|
||||||
```
|
```
|
||||||
|
|
||||||
|
[httpie]: https://httpie.io/cli
|
||||||
|
@ -7,6 +7,7 @@ use actix_web::{
|
|||||||
};
|
};
|
||||||
use actix_web_lab::middleware::{from_fn, Next};
|
use actix_web_lab::middleware::{from_fn, Next};
|
||||||
use aes_gcm_siv::{aead::Aead as _, Aes256GcmSiv, KeyInit as _, Nonce};
|
use aes_gcm_siv::{aead::Aead as _, Aes256GcmSiv, KeyInit as _, Nonce};
|
||||||
|
use base64::prelude::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
@ -34,10 +35,10 @@ async fn make_encrypted(
|
|||||||
|
|
||||||
// this nonce should actually be unique per message in a production environment
|
// this nonce should actually be unique per message in a production environment
|
||||||
let nonce = Nonce::from_slice(b"unique nonce");
|
let nonce = Nonce::from_slice(b"unique nonce");
|
||||||
let nonce_b64 = Some(base64::encode(nonce));
|
let nonce_b64 = Some(BASE64_STANDARD.encode(nonce));
|
||||||
|
|
||||||
let data_enc = cipher.encrypt(nonce, data.as_bytes()).unwrap();
|
let data_enc = cipher.encrypt(nonce, data.as_bytes()).unwrap();
|
||||||
let data_enc = base64::encode(data_enc);
|
let data_enc = BASE64_STANDARD.encode(data_enc);
|
||||||
|
|
||||||
web::Json(Req {
|
web::Json(Req {
|
||||||
id,
|
id,
|
||||||
@ -98,11 +99,11 @@ async fn encrypt_payloads(
|
|||||||
log::info!("decrypting request {id:?}");
|
log::info!("decrypting request {id:?}");
|
||||||
|
|
||||||
// decode nonce from payload
|
// decode nonce from payload
|
||||||
let nonce = base64::decode(nonce.unwrap()).unwrap();
|
let nonce = BASE64_STANDARD.decode(nonce.unwrap()).unwrap();
|
||||||
let nonce = Nonce::from_slice(&nonce);
|
let nonce = Nonce::from_slice(&nonce);
|
||||||
|
|
||||||
// decode and decrypt data field
|
// decode and decrypt data field
|
||||||
let data_enc = base64::decode(&data).unwrap();
|
let data_enc = BASE64_STANDARD.decode(&data).unwrap();
|
||||||
let data = cipher.decrypt(nonce, data_enc.as_slice()).unwrap();
|
let data = cipher.decrypt(nonce, data_enc.as_slice()).unwrap();
|
||||||
|
|
||||||
// construct request body format with plaintext data
|
// construct request body format with plaintext data
|
||||||
@ -136,11 +137,11 @@ async fn encrypt_payloads(
|
|||||||
|
|
||||||
// generate and encode nonce for later
|
// generate and encode nonce for later
|
||||||
let nonce = Nonce::from_slice(b"unique nonce");
|
let nonce = Nonce::from_slice(b"unique nonce");
|
||||||
let nonce_b64 = Some(base64::encode(nonce));
|
let nonce_b64 = Some(BASE64_STANDARD.encode(nonce));
|
||||||
|
|
||||||
// encrypt and encode data field
|
// encrypt and encode data field
|
||||||
let data_enc = cipher.encrypt(nonce, data.as_bytes()).unwrap();
|
let data_enc = cipher.encrypt(nonce, data.as_bytes()).unwrap();
|
||||||
let data_enc = base64::encode(data_enc);
|
let data_enc = BASE64_STANDARD.encode(data_enc);
|
||||||
|
|
||||||
// re-pack response into JSON format
|
// re-pack response into JSON format
|
||||||
let res_body = Res {
|
let res_body = Res {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use std::{env, io};
|
use std::io;
|
||||||
|
|
||||||
use actix_web::{
|
use actix_web::{
|
||||||
middleware,
|
middleware,
|
||||||
@ -7,7 +7,7 @@ use actix_web::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
mod add_msg;
|
mod add_msg;
|
||||||
use crate::add_msg::{AddMsg, Msg};
|
use self::add_msg::{AddMsg, Msg};
|
||||||
|
|
||||||
// wrap route in our middleware factory
|
// wrap route in our middleware factory
|
||||||
async fn index(msg: Option<ReqData<Msg>>) -> HttpResponse {
|
async fn index(msg: Option<ReqData<Msg>>) -> HttpResponse {
|
||||||
@ -21,8 +21,9 @@ async fn index(msg: Option<ReqData<Msg>>) -> HttpResponse {
|
|||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> io::Result<()> {
|
async fn main() -> io::Result<()> {
|
||||||
env::set_var("RUST_LOG", "info");
|
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||||
env_logger::init();
|
|
||||||
|
log::info!("starting HTTP server at http://localhost:8080");
|
||||||
|
|
||||||
HttpServer::new(|| {
|
HttpServer::new(|| {
|
||||||
App::new()
|
App::new()
|
||||||
|
@ -4,9 +4,11 @@ version = "1.0.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
env_logger.workspace = true
|
actix-web-lab.workspace = true
|
||||||
actix-web.workspace = true
|
actix-web.workspace = true
|
||||||
askama = "0.11.0"
|
askama = "0.12"
|
||||||
|
env_logger.workspace = true
|
||||||
|
log.workspace = true
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
askama = "0.11.0"
|
askama = "0.12"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use actix_web::{middleware, web, App, HttpResponse, HttpServer, Result};
|
use actix_web::{middleware, web, App, HttpServer, Responder, Result};
|
||||||
|
use actix_web_lab::respond::Html;
|
||||||
use askama::Template;
|
use askama::Template;
|
||||||
|
|
||||||
#[derive(Template)]
|
#[derive(Template)]
|
||||||
@ -14,26 +15,27 @@ struct UserTemplate<'a> {
|
|||||||
#[template(path = "index.html")]
|
#[template(path = "index.html")]
|
||||||
struct Index;
|
struct Index;
|
||||||
|
|
||||||
async fn index(query: web::Query<HashMap<String, String>>) -> Result<HttpResponse> {
|
async fn index(query: web::Query<HashMap<String, String>>) -> Result<impl Responder> {
|
||||||
let s = if let Some(name) = query.get("name") {
|
let html = if let Some(name) = query.get("name") {
|
||||||
UserTemplate {
|
UserTemplate {
|
||||||
name,
|
name,
|
||||||
text: "Welcome!",
|
text: "Welcome!",
|
||||||
}
|
}
|
||||||
.render()
|
.render()
|
||||||
.unwrap()
|
.expect("template should be valid")
|
||||||
} else {
|
} else {
|
||||||
Index.render().unwrap()
|
Index.render().expect("template should be valid")
|
||||||
};
|
};
|
||||||
Ok(HttpResponse::Ok().content_type("text/html").body(s))
|
|
||||||
|
Ok(Html(html))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
std::env::set_var("RUST_LOG", "actix_web=info");
|
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||||
env_logger::init();
|
|
||||||
|
log::info!("starting HTTP server at http://localhost:8080");
|
||||||
|
|
||||||
// start http server
|
|
||||||
HttpServer::new(move || {
|
HttpServer::new(move || {
|
||||||
App::new()
|
App::new()
|
||||||
.wrap(middleware::Logger::default())
|
.wrap(middleware::Logger::default())
|
||||||
|
@ -10,5 +10,5 @@ actix-utils.workspace = true
|
|||||||
|
|
||||||
env_logger.workspace = true
|
env_logger.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
minijinja = { version = "0.28", features = ["source"] }
|
minijinja = { version = "0.30", features = ["source"] }
|
||||||
minijinja-autoreload = "0.28"
|
minijinja-autoreload = "0.30"
|
||||||
|
@ -9,4 +9,4 @@ actix-web-lab.workspace = true
|
|||||||
|
|
||||||
env_logger.workspace = true
|
env_logger.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
sailfish = "0.5"
|
sailfish = "0.6"
|
||||||
|
@ -8,4 +8,5 @@ actix-web.workspace = true
|
|||||||
actix-web-lab.workspace = true
|
actix-web-lab.workspace = true
|
||||||
|
|
||||||
env_logger.workspace = true
|
env_logger.workspace = true
|
||||||
tera = "1.8.0"
|
log.workspace = true
|
||||||
|
tera = "1.8"
|
||||||
|
@ -33,16 +33,16 @@ async fn index(
|
|||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
std::env::set_var("RUST_LOG", "actix_web=info");
|
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||||
env_logger::init();
|
|
||||||
|
log::info!("starting HTTP server at http://localhost:8080");
|
||||||
|
|
||||||
println!("Listening on: 127.0.0.1:8080, open browser and visit have a try!");
|
|
||||||
HttpServer::new(|| {
|
HttpServer::new(|| {
|
||||||
let tera = Tera::new(concat!(env!("CARGO_MANIFEST_DIR"), "/templates/**/*")).unwrap();
|
let tera = Tera::new(concat!(env!("CARGO_MANIFEST_DIR"), "/templates/**/*")).unwrap();
|
||||||
|
|
||||||
App::new()
|
App::new()
|
||||||
.app_data(web::Data::new(tera))
|
.app_data(web::Data::new(tera))
|
||||||
.wrap(middleware::Logger::default()) // enable logger
|
.wrap(middleware::Logger::default())
|
||||||
.service(web::resource("/").route(web::get().to(index)))
|
.service(web::resource("/").route(web::get().to(index)))
|
||||||
.service(web::scope("").wrap(error_handlers()))
|
.service(web::scope("").wrap(error_handlers()))
|
||||||
})
|
})
|
||||||
|
@ -4,7 +4,8 @@ version = "1.0.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
env_logger.workspace = true
|
|
||||||
tinytemplate = "1.1"
|
|
||||||
actix-web.workspace = true
|
actix-web.workspace = true
|
||||||
|
env_logger.workspace = true
|
||||||
|
log.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
|
tinytemplate = "1.1"
|
||||||
|
@ -34,8 +34,9 @@ async fn index(
|
|||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
std::env::set_var("RUST_LOG", "actix_web=info");
|
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||||
env_logger::init();
|
|
||||||
|
log::info!("starting HTTP server at http://localhost:8080");
|
||||||
|
|
||||||
HttpServer::new(|| {
|
HttpServer::new(|| {
|
||||||
let mut tt = TinyTemplate::new();
|
let mut tt = TinyTemplate::new();
|
||||||
@ -45,7 +46,7 @@ async fn main() -> std::io::Result<()> {
|
|||||||
|
|
||||||
App::new()
|
App::new()
|
||||||
.app_data(web::Data::new(tt))
|
.app_data(web::Data::new(tt))
|
||||||
.wrap(middleware::Logger::default()) // enable logger
|
.wrap(middleware::Logger::default())
|
||||||
.service(web::resource("/").route(web::get().to(index)))
|
.service(web::resource("/").route(web::get().to(index)))
|
||||||
.service(web::scope("").wrap(error_handlers()))
|
.service(web::scope("").wrap(error_handlers()))
|
||||||
})
|
})
|
||||||
|
@ -6,9 +6,10 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web.workspace = true
|
actix-web.workspace = true
|
||||||
env_logger.workspace = true
|
|
||||||
yarte = { version = "0.15", features = ["bytes-buf", "html-min"] }
|
|
||||||
derive_more.workspace = true
|
derive_more.workspace = true
|
||||||
|
env_logger.workspace = true
|
||||||
|
log.workspace = true
|
||||||
|
yarte = { version = "0.15", features = ["bytes-buf", "html-min"] }
|
||||||
|
|
||||||
[build-dependencies.yarte_helpers]
|
[build-dependencies.yarte_helpers]
|
||||||
version = "0.15.6"
|
version = "0.15.6"
|
||||||
|
@ -23,10 +23,10 @@ async fn index(query: web::Query<HashMap<String, String>>) -> Result<HttpRespons
|
|||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
std::env::set_var("RUST_LOG", "actix_web=info");
|
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||||
env_logger::init();
|
|
||||||
|
log::info!("starting HTTP server at http://localhost:8080");
|
||||||
|
|
||||||
// start http server
|
|
||||||
HttpServer::new(move || App::new().wrap(Logger::default()).service(index))
|
HttpServer::new(move || App::new().wrap(Logger::default()).service(index))
|
||||||
.bind(("127.0.0.1", 8080))?
|
.bind(("127.0.0.1", 8080))?
|
||||||
.run()
|
.run()
|
||||||
|
@ -4,5 +4,6 @@ version = "1.0.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
env_logger.workspace = true
|
|
||||||
actix-web.workspace = true
|
actix-web.workspace = true
|
||||||
|
env_logger.workspace = true
|
||||||
|
log.workspace = true
|
||||||
|
@ -7,8 +7,9 @@ async fn index(_req: HttpRequest) -> &'static str {
|
|||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
::std::env::set_var("RUST_LOG", "actix_server=info,actix_web=info");
|
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
|
||||||
env_logger::init();
|
|
||||||
|
log::info!("starting HTTP server at http://localhost:8080");
|
||||||
|
|
||||||
HttpServer::new(|| {
|
HttpServer::new(|| {
|
||||||
App::new()
|
App::new()
|
||||||
@ -24,6 +25,6 @@ async fn main() -> std::io::Result<()> {
|
|||||||
|
|
||||||
#[cfg(not(unix))]
|
#[cfg(not(unix))]
|
||||||
fn main() -> std::io::Result<()> {
|
fn main() -> std::io::Result<()> {
|
||||||
println!("not supported");
|
log::info!("Example only runs on UNIX");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user