Skip to content

Commit c4dc5fe

Browse files
authored
ref(server): Reorganize the HTTP web module (#247)
Splits the HTTP module internally into smaller submodules that should make it easier to find and place functionality. The web listener, app, and middlewarers are now in separate modules. Additionally, `ApiResult` and its error has moved into an `endpoints::common` module. We can later replace this with an error type with individual variants.
1 parent 46df2e8 commit c4dc5fe

File tree

12 files changed

+320
-287
lines changed

12 files changed

+320
-287
lines changed

objectstore-server/src/auth/service.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use crate::auth::AuthContext;
1616
/// ```
1717
/// use axum::http::StatusCode;
1818
/// use objectstore_server::auth::AuthAwareService;
19-
/// use objectstore_server::error::ApiResult;
2019
///
2120
/// async fn my_endpoint(service: AuthAwareService) -> Result<StatusCode, StatusCode> {
2221
/// service.delete_object(todo!("pass some ID"))

objectstore-server/src/cli.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use anyhow::Result;
44
use argh::FromArgs;
55

66
use crate::config::Config;
7-
use crate::{healthcheck, http, observability};
7+
use crate::{healthcheck, observability, web};
88

99
/// Objectstore API webserver.
1010
#[derive(Debug, FromArgs)]
@@ -77,7 +77,7 @@ pub fn execute() -> Result<()> {
7777

7878
let result = runtime.block_on(async move {
7979
match args.command {
80-
Command::Run(RunCommand {}) => http::server(config).await,
80+
Command::Run(RunCommand {}) => web::server(config).await,
8181
Command::Healthcheck(HealthcheckCommand {}) => healthcheck::healthcheck(config).await,
8282
Command::Version(VersionCommand {}) => unreachable!(),
8383
}
File renamed without changes.

objectstore-server/src/endpoints/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use axum::Router;
66

77
use crate::state::ServiceState;
88

9+
mod common;
910
mod health;
1011
mod objects;
1112

objectstore-server/src/endpoints/objects.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use objectstore_types::Metadata;
1313
use serde::Serialize;
1414

1515
use crate::auth::AuthAwareService;
16-
use crate::error::ApiResult;
16+
use crate::endpoints::common::ApiResult;
1717
use crate::extractors::Xt;
1818
use crate::state::ServiceState;
1919

objectstore-server/src/http.rs

Lines changed: 0 additions & 280 deletions
This file was deleted.

objectstore-server/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ pub mod auth;
77
pub mod cli;
88
pub mod config;
99
pub mod endpoints;
10-
pub mod error;
1110
pub mod extractors;
1211
pub mod healthcheck;
13-
pub mod http;
1412
pub mod killswitches;
1513
pub mod observability;
1614
pub mod state;
15+
pub mod web;

0 commit comments

Comments
 (0)