Added readable mode for article content

This commit is contained in:
2023-10-15 17:44:05 +02:00
parent 3d77c6f30f
commit ee80cbd53b
17 changed files with 151 additions and 53 deletions
+17
View File
@@ -0,0 +1,17 @@
use actix_web::{HttpResponse, Responder};
use reqwest::StatusCode;
use serde::Serialize;
#[derive(Serialize)]
pub struct Readable {
pub content: String,
}
impl Responder for Readable {
type Body = String;
fn respond_to(self, _req: &actix_web::HttpRequest) -> actix_web::HttpResponse<Self::Body> {
let body = serde_json::to_string(&self).unwrap();
HttpResponse::with_body(StatusCode::OK, body)
}
}