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