From d5064a2c14f0263345ccca59e27d6ff5c1d2c6b9 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 16 Dec 2024 02:55:59 +0100 Subject: [PATCH] `apub_inbox`: Add `/inbox` route --- acrate_apub_inbox/src/main.rs | 1 + acrate_apub_inbox/src/route.rs | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/acrate_apub_inbox/src/main.rs b/acrate_apub_inbox/src/main.rs index 9a791f5..9c835ef 100644 --- a/acrate_apub_inbox/src/main.rs +++ b/acrate_apub_inbox/src/main.rs @@ -16,6 +16,7 @@ async fn main() -> anyhow::Result { log::trace!("Creating Axum router..."); let app = axum::Router::new() + .route("/inbox", axum::routing::post(route::inbox_handler)) .route("/.healthcheck", axum::routing::get(route::healthcheck_handler)) .layer(Extension(Arc::new(mj))); log::trace!("Axum router created successfully!"); diff --git a/acrate_apub_inbox/src/route.rs b/acrate_apub_inbox/src/route.rs index 97482d8..d367104 100644 --- a/acrate_apub_inbox/src/route.rs +++ b/acrate_apub_inbox/src/route.rs @@ -1,4 +1,4 @@ -use axum::http::StatusCode; +use axum::http::{Response, StatusCode}; use acrate_database::connect::connect_async; pub async fn healthcheck_handler() -> Result { @@ -12,3 +12,12 @@ pub async fn healthcheck_handler() -> Result { log::trace!("Healthcheck successful! Everything's fine!"); Ok(StatusCode::NO_CONTENT) } + +pub async fn inbox_handler() -> Result, StatusCode> { + log::debug!("Handling an inbox request!"); + + log::trace!("Creating a blank response..."); + let mut response = Response::new("".to_string()); + + Ok(response) +}