aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server/src/lib.rs
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-06-20 22:01:26 +0200
committerIlion Beyst <ilion.beyst@gmail.com>2022-06-20 22:01:26 +0200
commit951cb293111db9ea0947cd65872da744bce92d31 (patch)
treed232f6c1443b96b24d821fdf05b1d96037091c30 /planetwars-server/src/lib.rs
parenta2a8a41689ad07eb2236ee438e9d01266946008d (diff)
downloadplanetwars.dev-951cb293111db9ea0947cd65872da744bce92d31.tar.xz
planetwars.dev-951cb293111db9ea0947cd65872da744bce92d31.zip
upgrade to axum 0.5
Diffstat (limited to 'planetwars-server/src/lib.rs')
-rw-r--r--planetwars-server/src/lib.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/planetwars-server/src/lib.rs b/planetwars-server/src/lib.rs
index e50003c..9c9a03c 100644
--- a/planetwars-server/src/lib.rs
+++ b/planetwars-server/src/lib.rs
@@ -24,7 +24,7 @@ use axum::{
extract::{Extension, FromRequest, RequestParts},
http::StatusCode,
routing::{get, post},
- AddExtensionLayer, Router,
+ Router,
};
// TODO: make these configurable
@@ -105,12 +105,16 @@ pub fn get_config() -> Result<Configuration, ConfigError> {
.try_deserialize()
}
-async fn run_registry(_db_pool: DbPool) {
+async fn run_registry(db_pool: DbPool) {
// TODO: put in config
let addr = SocketAddr::from(([127, 0, 0, 1], 9001));
axum::Server::bind(&addr)
- .serve(registry_service().into_make_service())
+ .serve(
+ registry_service()
+ .layer(Extension(db_pool))
+ .into_make_service(),
+ )
.await
.unwrap();
}
@@ -124,7 +128,7 @@ pub async fn run_app() {
let api_service = Router::new()
.nest("/api", api())
- .layer(AddExtensionLayer::new(db_pool))
+ .layer(Extension(db_pool))
.into_make_service();
// TODO: put in config