webring-plusplus-server-actix 0.1.3

A webring++ service implementation for actix-web
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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: 1, links })
}

pub fn webring_plusplus_service(links: Vec<Cow<'static, str>>) -> impl HttpServiceFactory {
    web::resource("/webring++.json").route(web::get().to(move || webring_plusplus(links.clone())))
}