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

fix cors example

This commit is contained in:
Rob Ede 2022-03-15 17:32:27 +00:00
parent ba7812fb0a
commit c9ebeacf58
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
4 changed files with 96 additions and 83 deletions

168
Cargo.lock generated
View File

@ -117,11 +117,10 @@ dependencies = [
[[package]]
name = "actix-cors"
version = "0.6.0"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30dbd116ef7532f56e2f6d7c511736ea0b124d914ee8820a5271247bf89f06aa"
checksum = "414360eed71ba2d5435b185ba43ecbe281dfab5df3898286d6b7be8074372c92"
dependencies = [
"actix-service",
"actix-utils",
"actix-web",
"derive_more",
@ -156,9 +155,9 @@ dependencies = [
[[package]]
name = "actix-http"
version = "3.0.1"
version = "3.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5753ed977cb402da7f63445cfcca2f3e514189d516bd0b0d8cd1e24979bfcd3c"
checksum = "a5885cb81a0d4d0d322864bea1bb6c2a8144626b4fdc625d4c51eba197e7797a"
dependencies = [
"actix-codec",
"actix-rt",
@ -175,7 +174,7 @@ dependencies = [
"encoding_rs",
"flate2",
"futures-core",
"h2 0.3.11",
"h2 0.3.12",
"http",
"httparse",
"httpdate 1.0.2",
@ -315,9 +314,9 @@ dependencies = [
[[package]]
name = "actix-rt"
version = "2.6.0"
version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdf3f2183be1241ed4dd22611850b85d38de0b08a09f1f7bcccbd0809084b359"
checksum = "7ea16c295198e958ef31930a6ef37d0fb64e9ca3b6116e6b93a8bdae96ee1000"
dependencies = [
"actix-macros",
"futures-core",
@ -326,20 +325,20 @@ dependencies = [
[[package]]
name = "actix-server"
version = "2.0.0"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9e7472ac180abb0a8e592b653744345983a7a14f44691c8394a799d0df4dbbf"
checksum = "0da34f8e659ea1b077bb4637948b815cd3768ad5a188fdcd74ff4d84240cd824"
dependencies = [
"actix-rt",
"actix-service",
"actix-utils",
"futures-core",
"futures-util",
"log",
"mio 0.8.0",
"mio 0.8.1",
"num_cpus",
"socket2 0.4.4",
"tokio 1.17.0",
"tracing",
]
[[package]]
@ -689,9 +688,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.55"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "159bb86af3a200e19a068f4224eae4c8bb2d0fa054c7e5d1cacd5cef95e684cd"
checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27"
[[package]]
name = "arrayref"
@ -770,7 +769,7 @@ dependencies = [
"humansize",
"mime",
"mime_guess",
"nom 7.1.0",
"nom 7.1.1",
"num-traits 0.2.14",
"percent-encoding",
"proc-macro2",
@ -793,9 +792,9 @@ dependencies = [
[[package]]
name = "async-graphql"
version = "3.0.33"
version = "3.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0963d76eb680488eb844e0ff9b0bb6249d5d293d3b322a4e6d6e7db4f9e13819"
checksum = "92b114d420084d89c434865778bf5e3ad210cc9ef5572e11c700f902b8f8cfe6"
dependencies = [
"async-graphql-derive",
"async-graphql-parser",
@ -823,9 +822,9 @@ dependencies = [
[[package]]
name = "async-graphql-actix-web"
version = "3.0.33"
version = "3.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9985cd828b76cf9d29a0eb23285809905f789da484a4d47a19adfd14c2ea50f"
checksum = "6dd3ad6f273ad887f8def458eb9aeed1e7ed35dbd0063ef6cd7df84b5ee34652"
dependencies = [
"actix 0.13.0",
"actix-http",
@ -857,9 +856,9 @@ dependencies = [
[[package]]
name = "async-graphql-derive"
version = "3.0.33"
version = "3.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f907d2577211fd0e542439e70e2ad17533fcf0208a2c84b47ff6e7eeb4d9b4fa"
checksum = "75b06e8b1cef822c6a8699a4ec75de140019a996d7c0e8ce3b021e5c2d036fd8"
dependencies = [
"Inflector",
"async-graphql-parser",
@ -873,9 +872,9 @@ dependencies = [
[[package]]
name = "async-graphql-parser"
version = "3.0.33"
version = "3.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "759f63930ab8203f285c2f2821d311d31210819a4b1f0626b5a2b554e92095bf"
checksum = "863020a76049f6ac320a0e88350e0745e6392f73ed6fb08ebd6d56736abc28e7"
dependencies = [
"async-graphql-value",
"pest",
@ -886,9 +885,9 @@ dependencies = [
[[package]]
name = "async-graphql-value"
version = "3.0.33"
version = "3.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35d22aaffb19bce9f28f3e614aa7a029e612e9042e36bd665882856dc4c7cb79"
checksum = "d435e9006dc82138249a64969d820a8d344357ded2075ca93d764d91f26999c9"
dependencies = [
"bytes 1.1.0",
"indexmap",
@ -898,9 +897,9 @@ dependencies = [
[[package]]
name = "async-stream"
version = "0.3.2"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "171374e7e3b2504e0e5236e3b59260560f9fe94bfe9ac39ba5e4e929c5590625"
checksum = "dad5c83079eae9969be7fadefe640a1c566901f05ff91ab221de4b6f68d9507e"
dependencies = [
"async-stream-impl",
"futures-core",
@ -908,9 +907,9 @@ dependencies = [
[[package]]
name = "async-stream-impl"
version = "0.3.2"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308"
checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27"
dependencies = [
"proc-macro2",
"quote",
@ -996,9 +995,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "awc"
version = "3.0.0-beta.21"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d91ad5074d7d2d8be6ef74d4ecb79c0f4d5f58bdc7ec896d5fbaa9f2fb9bfa5e"
checksum = "65c60c44fbf3c8cee365e86b97d706e513b733c4eeb16437b45b88d2fffe889a"
dependencies = [
"actix-codec",
"actix-http",
@ -1014,7 +1013,7 @@ dependencies = [
"derive_more",
"futures-core",
"futures-util",
"h2 0.3.11",
"h2 0.3.12",
"http",
"itoa 1.0.1",
"log",
@ -1399,9 +1398,9 @@ dependencies = [
[[package]]
name = "clap"
version = "3.1.5"
version = "3.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ced1892c55c910c1219e98d6fc8d71f6bddba7905866ce740066d8bfea859312"
checksum = "d8c93436c21e4698bacadf42917db28b23017027a4deccb35dbe47a7e7840123"
dependencies = [
"atty",
"bitflags",
@ -1624,9 +1623,9 @@ dependencies = [
[[package]]
name = "crossbeam-channel"
version = "0.5.2"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa"
checksum = "fdbfe11fe19ff083c48923cf179540e8cd0535903dc35e178a1fdeeb59aef51f"
dependencies = [
"cfg-if 1.0.0",
"crossbeam-utils",
@ -1634,9 +1633,9 @@ dependencies = [
[[package]]
name = "crossbeam-queue"
version = "0.3.4"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dd435b205a4842da59efd07628f921c096bc1cc0a156835b4fa0bcb9a19bcce"
checksum = "1f25d8400f4a7a5778f0e4e52384a48cbd9b5c495d110786187fc750075277a2"
dependencies = [
"cfg-if 1.0.0",
"crossbeam-utils",
@ -1644,9 +1643,9 @@ dependencies = [
[[package]]
name = "crossbeam-utils"
version = "0.8.7"
version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e5bed1f1c269533fa816a0a5492b3545209a205ca1a54842be180eb63a16a6"
checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38"
dependencies = [
"cfg-if 1.0.0",
"lazy_static",
@ -2074,9 +2073,9 @@ dependencies = [
[[package]]
name = "flume"
version = "0.10.11"
version = "0.10.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b279436a715a9de95dcd26b151db590a71961cc06e54918b24fe0dd5b7d3fc4"
checksum = "843c03199d0c0ca54bc1ea90ac0d507274c28abcc4f691ae8b4eaa375087c76a"
dependencies = [
"futures-core",
"futures-sink",
@ -2380,9 +2379,9 @@ dependencies = [
[[package]]
name = "h2"
version = "0.3.11"
version = "0.3.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9f1f717ddc7b2ba36df7e871fd88db79326551d3d6f1fc406fbfd28b582ff8e"
checksum = "62eeb471aa3e3c9197aa4bfeabfe02982f6dc96f750486c0bb0009ac58b26d2b"
dependencies = [
"bytes 1.1.0",
"fnv",
@ -2399,9 +2398,9 @@ dependencies = [
[[package]]
name = "handlebars"
version = "4.2.1"
version = "4.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25546a65e5cf1f471f3438796fc634650b31d7fcde01d444c309aeb28b92e3a8"
checksum = "99d6a30320f094710245150395bc763ad23128d6a1ebbad7594dc4164b62c56b"
dependencies = [
"log",
"pest",
@ -2630,7 +2629,7 @@ dependencies = [
"futures-channel",
"futures-core",
"futures-util",
"h2 0.3.11",
"h2 0.3.12",
"http",
"http-body 0.4.4",
"httparse",
@ -2766,9 +2765,9 @@ dependencies = [
[[package]]
name = "ipnet"
version = "2.3.1"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9"
checksum = "35e70ee094dc02fd9c13fdad4940090f22dbd6ac7c9e7094a46cf0232a50bc7c"
[[package]]
name = "itertools"
@ -3012,9 +3011,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.119"
version = "0.2.120"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4"
checksum = "ad5c14e80759d0939d013e6ca49930e59fc53dd8e5009132f76240c179380c09"
[[package]]
name = "libsqlite3-sys"
@ -3029,9 +3028,9 @@ dependencies = [
[[package]]
name = "libz-sys"
version = "1.1.3"
version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66"
checksum = "6f35facd4a5673cb5a48822be2be1d4236c1c99cb4113cab7061ac720d5bf859"
dependencies = [
"cc",
"pkg-config",
@ -3258,14 +3257,15 @@ dependencies = [
[[package]]
name = "mio"
version = "0.8.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba272f85fa0b41fc91872be579b3bbe0f56b792aa361a380eb669469f68dafb2"
checksum = "7ba42135c6a5917b9db9cd7b293e5409e1c6b041e6f9825e92e55a894c63b6f8"
dependencies = [
"libc",
"log",
"miow 0.3.7",
"ntapi",
"wasi 0.11.0+wasi-snapshot-preview1",
"winapi 0.3.9",
]
@ -3532,13 +3532,12 @@ dependencies = [
[[package]]
name = "nom"
version = "7.1.0"
version = "7.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b1d11e1ef389c76fe5b81bcaf2ea32cf88b62bc494e19f493d0b30e7a930109"
checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36"
dependencies = [
"memchr",
"minimal-lexical",
"version_check",
]
[[package]]
@ -3601,9 +3600,9 @@ dependencies = [
[[package]]
name = "num_threads"
version = "0.1.3"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97ba99ba6393e2c3734791401b66902d981cb03bf190af674ca69949b6d5fb15"
checksum = "c539a50b93a303167eded6e8dff5220cd39447409fb659f4cd24b1f72fe4f133"
dependencies = [
"libc",
]
@ -3660,7 +3659,7 @@ dependencies = [
"env_logger",
"log",
"openssl",
"reqwest 0.11.9",
"reqwest 0.11.10",
]
[[package]]
@ -4344,9 +4343,9 @@ dependencies = [
[[package]]
name = "regex"
version = "1.5.4"
version = "1.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
dependencies = [
"aho-corasick",
"memchr",
@ -4412,16 +4411,16 @@ dependencies = [
[[package]]
name = "reqwest"
version = "0.11.9"
version = "0.11.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f242f1488a539a79bac6dbe7c8609ae43b7914b7736210f239a37cccb32525"
checksum = "46a1f7aa4f35e5e8b4160449f51afc758f0ce6454315a9fa7d0d113e958c41eb"
dependencies = [
"base64 0.13.0",
"bytes 1.1.0",
"encoding_rs",
"futures-core",
"futures-util",
"h2 0.3.11",
"h2 0.3.12",
"http",
"http-body 0.4.4",
"hyper 0.14.17",
@ -4443,7 +4442,7 @@ dependencies = [
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"winreg 0.7.0",
"winreg 0.10.1",
]
[[package]]
@ -5122,9 +5121,9 @@ dependencies = [
[[package]]
name = "siphasher"
version = "0.3.9"
version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a86232ab60fa71287d7f2ddae4a7073f6b7aac33631c3015abb556f08c6d0a3e"
checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
[[package]]
name = "slab"
@ -5212,7 +5211,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4b7922be017ee70900be125523f38bdd644f4f06a1b16e8fa5a8ee8c34bffd4"
dependencies = [
"itertools",
"nom 7.1.0",
"nom 7.1.1",
"unicode_categories",
]
@ -5442,9 +5441,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
[[package]]
name = "syn"
version = "1.0.86"
version = "1.0.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b"
checksum = "ebd69e719f31e88618baa1eaa6ee2de5c9a1c004f1e9ecdb58e8352a13f20a01"
dependencies = [
"proc-macro2",
"quote",
@ -5759,7 +5758,7 @@ dependencies = [
"bytes 1.1.0",
"libc",
"memchr",
"mio 0.8.0",
"mio 0.8.1",
"num_cpus",
"once_cell",
"parking_lot 0.12.0",
@ -5948,9 +5947,9 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6"
[[package]]
name = "tracing"
version = "0.1.31"
version = "0.1.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6c650a8ef0cd2dd93736f033d21cbd1224c5a967aa0c258d00fcf7dafef9b9f"
checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f"
dependencies = [
"cfg-if 1.0.0",
"log",
@ -5960,9 +5959,9 @@ dependencies = [
[[package]]
name = "tracing-core"
version = "0.1.22"
version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03cfcb51380632a72d3111cb8d3447a8d908e577d31beeac006f836383d29a23"
checksum = "aa31669fa42c09c34d94d8165dd2012e8ff3c66aca50f3bb226b68f216f2706c"
dependencies = [
"lazy_static",
]
@ -6397,6 +6396,12 @@ version = "0.10.2+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
version = "0.2.79"
@ -6703,6 +6708,15 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "winreg"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "ws2_32-sys"
version = "0.2.1"

View File

@ -5,8 +5,7 @@ mod user;
#[actix_web::main]
async fn main() -> std::io::Result<()> {
std::env::set_var("RUST_LOG", "actix=info");
env_logger::init();
env_logger::init_from_env(env_logger::Env::default().default_filter_or("info"));
HttpServer::new(move || {
App::new()
@ -22,7 +21,7 @@ async fn main() -> std::io::Result<()> {
.wrap(Logger::default())
.service(user::info)
})
.bind(("127.0.0.1", 8000))?
.bind(("127.0.0.1", 8080))?
.run()
.await
}

View File

@ -10,7 +10,7 @@
"vue": "2.6.12"
},
"devDependencies": {
"@vue/cli-service": "^3.0.0",
"vue-template-compiler": "2.6.12"
"@vue/cli-service": "^5.0.0",
"vue-template-compiler": "^2.6.0"
}
}

View File

@ -14,7 +14,7 @@
<div id="user-info">
<p>Click Above 'Sign up' Button <br> Then Get Your Signup Info!</p>
<p>email : {{ email }}</p>
<p>username {{ username }}</p>
<p>username : {{ username }}</p>
<p>password : {{ password }}</p>
</div>
</div>