relay/src/routes.rs

37 lines
696 B
Rust
Raw Normal View History

2020-03-23 17:38:39 +00:00
mod actor;
mod inbox;
mod index;
mod media;
2020-03-23 17:38:39 +00:00
mod nodeinfo;
mod statics;
2021-02-10 04:17:20 +00:00
pub(crate) use self::{
2020-03-23 17:38:39 +00:00
actor::route as actor,
inbox::route as inbox,
index::route as index,
media::route as media,
2020-03-23 17:38:39 +00:00
nodeinfo::{route as nodeinfo, well_known as nodeinfo_meta},
statics::route as statics,
};
use actix_web::HttpResponse;
use serde::ser::Serialize;
static CONTENT_TYPE: &str = "application/activity+json";
fn ok<T>(item: T) -> HttpResponse
where
T: Serialize,
{
2021-02-11 00:00:11 +00:00
HttpResponse::Ok().content_type(CONTENT_TYPE).json(&item)
2020-03-23 17:38:39 +00:00
}
fn accepted<T>(item: T) -> HttpResponse
where
T: Serialize,
{
HttpResponse::Accepted()
.content_type(CONTENT_TYPE)
2021-02-11 00:00:11 +00:00
.json(&item)
2020-03-23 17:38:39 +00:00
}