mirror of
https://github.com/actix/examples
synced 2024-11-23 22:41:07 +01:00
upgrade to beta3
This commit is contained in:
parent
d571ee5abb
commit
8de183768c
@ -6,8 +6,8 @@ edition = "2018"
|
|||||||
workspace = ".."
|
workspace = ".."
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix = "0.8.0-alpha.2"
|
actix = "0.8.1"
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
actix-redis = { git="https://github.com/actix/actix-redis.git" }
|
actix-redis = { git="https://github.com/actix/actix-redis.git" }
|
||||||
futures = "0.1.23"
|
futures = "0.1.23"
|
||||||
redis-async = "0.4.0"
|
redis-async = "0.4.0"
|
||||||
|
@ -6,9 +6,9 @@ workspace = ".."
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
actix-files = "0.1.0-alpha.4"
|
actix-files = "0.1.0-beta.1"
|
||||||
actix-session = "0.1.0-alpha.4"
|
actix-session = "0.1.0-beta.2"
|
||||||
dotenv = "0.13.0"
|
dotenv = "0.13.0"
|
||||||
env_logger = "0.5.10"
|
env_logger = "0.5.10"
|
||||||
futures = "0.1.22"
|
futures = "0.1.22"
|
||||||
|
@ -7,7 +7,7 @@ workspace = ".."
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-rt = "0.2"
|
actix-rt = "0.2"
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
|
|
||||||
dotenv = "0.10"
|
dotenv = "0.10"
|
||||||
env_logger = "0.5"
|
env_logger = "0.5"
|
||||||
|
@ -7,9 +7,9 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-rt = "0.2"
|
actix-rt = "0.2"
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
actix-files = "0.1.0-alpha.4"
|
actix-files = "0.1.0-beta.1"
|
||||||
actix-session = "0.1.0-alpha.4"
|
actix-session = "0.1.0-beta.2"
|
||||||
|
|
||||||
futures = "0.1.25"
|
futures = "0.1.25"
|
||||||
env_logger = "0.5"
|
env_logger = "0.5"
|
||||||
|
@ -6,5 +6,5 @@ edition = "2018"
|
|||||||
workspace = ".."
|
workspace = ".."
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
env_logger = "0.6"
|
env_logger = "0.6"
|
||||||
|
@ -6,8 +6,8 @@ workspace = ".."
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
actix-session = "0.1.0-alpha.4"
|
actix-session = "0.1.0-beta.2"
|
||||||
|
|
||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
time = "0.1"
|
time = "0.1"
|
||||||
|
@ -6,7 +6,7 @@ workspace = ".."
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
|
|
||||||
bytes = "0.4"
|
bytes = "0.4"
|
||||||
env_logger = "0.6"
|
env_logger = "0.6"
|
||||||
|
@ -137,22 +137,20 @@ fn main() -> std::io::Result<()> {
|
|||||||
// Use of the extractors makes some post conditions simpler such
|
// Use of the extractors makes some post conditions simpler such
|
||||||
// as size limit protections and built in json validation.
|
// as size limit protections and built in json validation.
|
||||||
.service(
|
.service(
|
||||||
web::resource("/add2").route(
|
web::resource("/add2")
|
||||||
web::post()
|
.data(
|
||||||
.data(
|
web::JsonConfig::default()
|
||||||
web::JsonConfig::default()
|
.limit(4096) // <- limit size of the payload
|
||||||
.limit(4096) // <- limit size of the payload
|
.error_handler(|err, _| {
|
||||||
.error_handler(|err, _| {
|
// <- create custom error response
|
||||||
// <- create custom error response
|
error::InternalError::from_response(
|
||||||
error::InternalError::from_response(
|
err,
|
||||||
err,
|
HttpResponse::Conflict().finish(),
|
||||||
HttpResponse::Conflict().finish(),
|
)
|
||||||
)
|
.into()
|
||||||
.into()
|
}),
|
||||||
}),
|
)
|
||||||
)
|
.route(web::post().to_async(add2)),
|
||||||
.to_async(add2),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
// Manual parsing would allow custom error construction, use of
|
// Manual parsing would allow custom error construction, use of
|
||||||
// other parsers *beside* json (for example CBOR, protobuf, xml), and allows
|
// other parsers *beside* json (for example CBOR, protobuf, xml), and allows
|
||||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
|||||||
workspace = ".."
|
workspace = ".."
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
|
|
||||||
derive_more = "0.14.0"
|
derive_more = "0.14.0"
|
||||||
futures = "0.1.23"
|
futures = "0.1.23"
|
||||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
|||||||
workspace = ".."
|
workspace = ".."
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
|
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
|
@ -6,5 +6,5 @@ workspace = ".."
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
env_logger = "0.6"
|
env_logger = "0.6"
|
||||||
|
@ -7,7 +7,7 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-rt = "0.2"
|
actix-rt = "0.2"
|
||||||
actix-web = "1.0.0-alpha.5"
|
actix-web = "1.0.0-beta.3"
|
||||||
|
|
||||||
clap = "2.32.0"
|
clap = "2.32.0"
|
||||||
futures = "0.1.25"
|
futures = "0.1.25"
|
||||||
|
@ -15,7 +15,7 @@ path = "src/server.rs"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-rt = "0.2"
|
actix-rt = "0.2"
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
|
|
||||||
env_logger = "0.5"
|
env_logger = "0.5"
|
||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
|
@ -6,7 +6,7 @@ workspace = ".."
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
|
|
||||||
bytes = "0.4"
|
bytes = "0.4"
|
||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
|
@ -83,19 +83,12 @@ fn main() -> std::io::Result<()> {
|
|||||||
App::new()
|
App::new()
|
||||||
// enable logger
|
// enable logger
|
||||||
.wrap(middleware::Logger::default())
|
.wrap(middleware::Logger::default())
|
||||||
|
.data(web::JsonConfig::default().limit(4096)) // <- limit size of the payload (global configuration)
|
||||||
|
.service(web::resource("/extractor").route(web::post().to(index)))
|
||||||
.service(
|
.service(
|
||||||
web::resource("/extractor").route(
|
web::resource("/extractor2")
|
||||||
web::post()
|
.data(web::JsonConfig::default().limit(1024)) // <- limit size of the payload (resource level)
|
||||||
.data(web::JsonConfig::default().limit(4096)) // <- limit size of the payload
|
.route(web::post().to_async(extract_item)),
|
||||||
.to(index),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.service(
|
|
||||||
web::resource("/extractor2").route(
|
|
||||||
web::post()
|
|
||||||
.data(web::JsonConfig::default().limit(4096)) // <- limit size of the payload
|
|
||||||
.to_async(extract_item),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
.service(web::resource("/manual").route(web::post().to_async(index_manual)))
|
.service(web::resource("/manual").route(web::post().to_async(index_manual)))
|
||||||
.service(
|
.service(
|
||||||
|
@ -6,8 +6,8 @@ edition = "2018"
|
|||||||
workspace = ".."
|
workspace = ".."
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix = "0.8.0-alpha.2"
|
actix = "0.8.1"
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
env_logger = "0.6"
|
env_logger = "0.6"
|
||||||
futures = "0.1.23"
|
futures = "0.1.23"
|
||||||
futures-timer = "0.1"
|
futures-timer = "0.1"
|
||||||
|
@ -6,7 +6,7 @@ workspace = ".."
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
env_logger = "0.6"
|
env_logger = "0.6"
|
||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
|
@ -7,6 +7,6 @@ workspace = ".."
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-service = "0.3.6"
|
actix-service = "0.3.6"
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
futures = "0.1.25"
|
futures = "0.1.25"
|
||||||
env_logger = "0.6"
|
env_logger = "0.6"
|
@ -10,7 +10,7 @@ name = "multipart"
|
|||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "1.0.0-beta.1"
|
actix-web = "1.0.0-beta.3"
|
||||||
actix-multipart = "0.1.0-beta.1"
|
actix-multipart = "0.1.0-beta.1"
|
||||||
|
|
||||||
env_logger = "0.6"
|
env_logger = "0.6"
|
||||||
|
@ -23,11 +23,10 @@ pub fn save_file(field: Field) -> impl Future<Item = i64, Error = Error> {
|
|||||||
// fs operations are blocking, we have to execute writes
|
// fs operations are blocking, we have to execute writes
|
||||||
// on threadpool
|
// on threadpool
|
||||||
web::block(move || {
|
web::block(move || {
|
||||||
file.write_all(bytes.as_ref())
|
file.write_all(bytes.as_ref()).map_err(|e| {
|
||||||
.map_err(|e| {
|
println!("file.write_all failed: {:?}", e);
|
||||||
println!("file.write_all failed: {:?}", e);
|
MultipartError::Payload(error::PayloadError::Io(e))
|
||||||
MultipartError::Payload(error::PayloadError::Io(e))
|
})?;
|
||||||
})?;
|
|
||||||
acc += bytes.len() as i64;
|
acc += bytes.len() as i64;
|
||||||
Ok((file, acc))
|
Ok((file, acc))
|
||||||
})
|
})
|
||||||
|
@ -13,4 +13,4 @@ derive_more = "0.14"
|
|||||||
prost = "0.2.0"
|
prost = "0.2.0"
|
||||||
prost-derive = "0.2.0"
|
prost-derive = "0.2.0"
|
||||||
|
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
|
@ -7,7 +7,7 @@ workspace = ".."
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-rt = "0.2"
|
actix-rt = "0.2"
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
|
|
||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
env_logger = "0.6"
|
env_logger = "0.6"
|
||||||
|
@ -6,8 +6,8 @@ workspace = ".."
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix = "0.8.0-alpha.2"
|
actix = "0.8.1"
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
actix-session = "0.1.0-alpha.4"
|
actix-session = "0.1.0-beta.2"
|
||||||
actix-redis = { git = "https://github.com/actix/actix-redis.git", features = ["web"] }
|
actix-redis = { git = "https://github.com/actix/actix-redis.git", features = ["web"] }
|
||||||
env_logger = "0.6"
|
env_logger = "0.6"
|
||||||
|
@ -8,7 +8,7 @@ workspace = ".."
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
actix = { version = "0.8.1", features = ["http"] }
|
actix = { version = "0.8.1", features = ["http"] }
|
||||||
actix-rt = "0.2.2"
|
actix-rt = "0.2.2"
|
||||||
actix-web = "1.0.0-beta.1"
|
actix-web = "1.0.0-beta.3"
|
||||||
actix-files = "0.1.0-beta.1"
|
actix-files = "0.1.0-beta.1"
|
||||||
|
|
||||||
bcrypt = "0.2.1"
|
bcrypt = "0.2.1"
|
||||||
|
@ -6,6 +6,6 @@ workspace = ".."
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
futures = "0.1.25"
|
futures = "0.1.25"
|
||||||
env_logger = "0.6"
|
env_logger = "0.6"
|
||||||
|
@ -9,5 +9,5 @@ edition = "2018"
|
|||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
env_logger = "0.5"
|
env_logger = "0.5"
|
||||||
|
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
actix-files = "0.1.0-alpha.4"
|
actix-files = "0.1.0-beta.1"
|
||||||
|
@ -6,7 +6,7 @@ workspace = ".."
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
env_logger = "0.6"
|
env_logger = "0.6"
|
||||||
askama = "0.8"
|
askama = "0.8"
|
||||||
|
|
||||||
|
@ -8,4 +8,4 @@ edition = "2018"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
env_logger = "0.6"
|
env_logger = "0.6"
|
||||||
tera = "0.11"
|
tera = "0.11"
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
|
@ -12,7 +12,7 @@ env_logger = "0.6"
|
|||||||
|
|
||||||
yarte = { version = "0.2", features=["with-actix-web"] }
|
yarte = { version = "0.2", features=["with-actix-web"] }
|
||||||
|
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
yarte = { version = "0.2", features=["with-actix-web"] }
|
yarte = { version = "0.2", features=["with-actix-web"] }
|
||||||
|
@ -6,7 +6,7 @@ workspace = "../../"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
@ -10,10 +10,10 @@ name = "websocket-chat-server"
|
|||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix = "0.8.0-alpha.2"
|
actix = "0.8.1"
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
actix-web-actors = "1.0.0-alpha.2"
|
actix-web-actors = "1.0.0-alpha.3"
|
||||||
actix-files = "0.1.0-alpha.4"
|
actix-files = "0.1.0-beta.1"
|
||||||
|
|
||||||
rand = "0.6"
|
rand = "0.6"
|
||||||
bytes = "0.4"
|
bytes = "0.4"
|
||||||
|
@ -14,10 +14,10 @@ name = "websocket-tcp-client"
|
|||||||
path = "src/client.rs"
|
path = "src/client.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix = "0.8.0-alpha.2"
|
actix = "0.8.1"
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
actix-web-actors = "1.0.0-alpha.3"
|
actix-web-actors = "1.0.0-alpha.3"
|
||||||
actix-files = "0.1.0-alpha.4"
|
actix-files = "0.1.0-beta.1"
|
||||||
|
|
||||||
rand = "0.6"
|
rand = "0.6"
|
||||||
bytes = "0.4"
|
bytes = "0.4"
|
||||||
|
@ -14,10 +14,10 @@ path = "src/main.rs"
|
|||||||
#path = "src/client.rs"
|
#path = "src/client.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix = "0.8.0-alpha.2"
|
actix = "0.8.1"
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.3"
|
||||||
actix-web-actors = "1.0.0-alpha.3"
|
actix-web-actors = "1.0.0-alpha.3"
|
||||||
actix-files = "0.1.0-alpha.4"
|
actix-files = "0.1.0-beta.1"
|
||||||
env_logger = "0.6"
|
env_logger = "0.6"
|
||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
bytes = "0.4"
|
bytes = "0.4"
|
Loading…
Reference in New Issue
Block a user