apub_inbox: Add /inbox route

This commit is contained in:
Steffo 2024-12-16 02:55:59 +01:00
parent e72fa092fb
commit d5064a2c14
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
2 changed files with 11 additions and 1 deletions

View file

@ -16,6 +16,7 @@ async fn main() -> anyhow::Result<std::convert::Infallible> {
log::trace!("Creating Axum router..."); log::trace!("Creating Axum router...");
let app = axum::Router::new() let app = axum::Router::new()
.route("/inbox", axum::routing::post(route::inbox_handler))
.route("/.healthcheck", axum::routing::get(route::healthcheck_handler)) .route("/.healthcheck", axum::routing::get(route::healthcheck_handler))
.layer(Extension(Arc::new(mj))); .layer(Extension(Arc::new(mj)));
log::trace!("Axum router created successfully!"); log::trace!("Axum router created successfully!");

View file

@ -1,4 +1,4 @@
use axum::http::StatusCode; use axum::http::{Response, StatusCode};
use acrate_database::connect::connect_async; use acrate_database::connect::connect_async;
pub async fn healthcheck_handler() -> Result<StatusCode, StatusCode> { pub async fn healthcheck_handler() -> Result<StatusCode, StatusCode> {
@ -12,3 +12,12 @@ pub async fn healthcheck_handler() -> Result<StatusCode, StatusCode> {
log::trace!("Healthcheck successful! Everything's fine!"); log::trace!("Healthcheck successful! Everything's fine!");
Ok(StatusCode::NO_CONTENT) Ok(StatusCode::NO_CONTENT)
} }
pub async fn inbox_handler() -> Result<Response<String>, StatusCode> {
log::debug!("Handling an inbox request!");
log::trace!("Creating a blank response...");
let mut response = Response::new("".to_string());
Ok(response)
}