20 lines
492 B
Rust
Executable File
20 lines
492 B
Rust
Executable File
use actix_web::{HttpResponse, Responder};
|
|
use reqwest::StatusCode;
|
|
use serde::Serialize;
|
|
|
|
use crate::reader::structs::feed::FeedAggregate;
|
|
|
|
#[derive(Serialize)]
|
|
pub struct Articles {
|
|
pub feeds: Vec<FeedAggregate>,
|
|
}
|
|
|
|
impl Responder for Articles {
|
|
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)
|
|
}
|
|
}
|