add API /love
Some checks failed
ci/woodpecker/push/publish Pipeline failed

This commit is contained in:
Mylloon 2023-05-23 10:04:02 +02:00
parent 1c3c63dec1
commit 53f491cdcc
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
3 changed files with 18 additions and 1 deletions

View file

@ -3,7 +3,8 @@ use actix_web::{middleware::DefaultHeaders, web, App, HttpServer};
use std::io::Result;
use crate::routes::{
agreements, blog, contrib, cours, cv, gaming, index, networks, not_found, portfolio, web3,
agreements, api_v1, blog, contrib, cours, cv, gaming, index, networks, not_found, portfolio,
web3,
};
mod config;
@ -32,6 +33,7 @@ async fn main() -> Result<()> {
"Onion-Location",
config.fc.onion.as_deref().unwrap_or_default(),
)))
.service(web::scope("/api").service(web::scope("v1").service(api_v1::love)))
.service(index::page)
.service(agreements::security)
.service(agreements::humans)

14
src/routes/api_v1.rs Normal file
View file

@ -0,0 +1,14 @@
use actix_web::{get, HttpResponse, Responder};
use serde::Serialize;
#[derive(Serialize)]
struct Info {
unix_epoch: u32,
}
#[get("/love")]
pub async fn love() -> impl Responder {
HttpResponse::Ok().json(Info {
unix_epoch: 1605576600,
})
}

View file

@ -1,4 +1,5 @@
pub mod agreements;
pub mod api_v1;
pub mod blog;
pub mod contrib;
pub mod cours;