WIP: Create apub_inbox crate #8

Draft
steffo wants to merge 40 commits from feature/apub-inbox into main
2 changed files with 15 additions and 0 deletions
Showing only changes of commit e72fa092fb - Show all commits

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("/.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

@ -0,0 +1,14 @@
use axum::http::StatusCode;
use acrate_database::connect::connect_async;
pub async fn healthcheck_handler() -> Result<StatusCode, StatusCode> {
log::debug!("Handling an healthcheck request!");
log::trace!("Making sure the database is up...");
let _conn = connect_async()
.await
.map_err(|_| StatusCode::BAD_GATEWAY)?;
log::trace!("Healthcheck successful! Everything's fine!");
Ok(StatusCode::NO_CONTENT)
}