diff options
| author | Fuwn <[email protected]> | 2022-01-14 17:05:07 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-01-14 17:05:07 -0800 |
| commit | 844f99dc13333eb4a1fa38ef1d0aa0ea836f1d4a (patch) | |
| tree | 5501937b4b481999f4468abbb37ea1b9c7da8536 | |
| parent | feat(server): indicate which server type accepted client (diff) | |
| download | whirl-844f99dc13333eb4a1fa38ef1d0aa0ea836f1d4a.tar.xz whirl-844f99dc13333eb4a1fa38ef1d0aa0ea836f1d4a.zip | |
chore(whirl_api): update axum finally
| -rw-r--r-- | crates/whirl_api/Cargo.toml | 4 | ||||
| -rw-r--r-- | crates/whirl_api/src/lib.rs | 7 |
2 files changed, 5 insertions, 6 deletions
diff --git a/crates/whirl_api/Cargo.toml b/crates/whirl_api/Cargo.toml index b851053..30a2986 100644 --- a/crates/whirl_api/Cargo.toml +++ b/crates/whirl_api/Cargo.toml @@ -14,9 +14,7 @@ publish = false [dependencies] # Web-server -actix-web = { version = "3.3.2", features = ["rustls"] } -actix-cors = "0.5.4" -axum = "0.1.3" +axum = "0.4.4" hyper = "0.14.13" # Utility diff --git a/crates/whirl_api/src/lib.rs b/crates/whirl_api/src/lib.rs index d3c3a0c..efbec1a 100644 --- a/crates/whirl_api/src/lib.rs +++ b/crates/whirl_api/src/lib.rs @@ -30,7 +30,7 @@ extern crate log; #[macro_use] extern crate serde_derive; -use axum::prelude::*; +use axum::routing::get; mod routes; @@ -47,12 +47,13 @@ impl Api { /// server. pub async fn listen(address: &str) { // TODO: Version handler - let app = route("/", get(|| async { "Whirlsplash" })) + let app = axum::Router::new() + .route("/", get(|| async { "Whirlsplash" })) .route("/api/v1/stats", get(routes::stats::statistics)) .route("/api/v1/worlds/info", get(routes::worlds::info::info)) .route("/api/v1/worlds/vip", get(routes::worlds::vip::vip)); - hyper::Server::bind(&address.parse().unwrap()) + axum::Server::bind(&address.parse().unwrap()) .serve(app.into_make_service()) .await .unwrap(); |