1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
use std::borrow::Cow; use actix_web::{dev::HttpServiceFactory, web, Responder}; use serde::Serialize; #[derive(Serialize)] pub struct WebringPlusplus { version: u32, links: Vec<Cow<'static, str>>, } pub async fn webring_plusplus(links: Vec<Cow<'static, str>>) -> impl Responder { web::Json(WebringPlusplus { version: 0, links: links, }) } pub fn webring_plusplus_service(links: Vec<Cow<'static, str>>) -> impl HttpServiceFactory { web::resource("/webring++").route(web::get().to(move || webring_plusplus(links.clone()))) }