This commit is contained in:
parent
1c3c63dec1
commit
53f491cdcc
3 changed files with 18 additions and 1 deletions
|
@ -3,7 +3,8 @@ use actix_web::{middleware::DefaultHeaders, web, App, HttpServer};
|
||||||
use std::io::Result;
|
use std::io::Result;
|
||||||
|
|
||||||
use crate::routes::{
|
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;
|
mod config;
|
||||||
|
@ -32,6 +33,7 @@ async fn main() -> Result<()> {
|
||||||
"Onion-Location",
|
"Onion-Location",
|
||||||
config.fc.onion.as_deref().unwrap_or_default(),
|
config.fc.onion.as_deref().unwrap_or_default(),
|
||||||
)))
|
)))
|
||||||
|
.service(web::scope("/api").service(web::scope("v1").service(api_v1::love)))
|
||||||
.service(index::page)
|
.service(index::page)
|
||||||
.service(agreements::security)
|
.service(agreements::security)
|
||||||
.service(agreements::humans)
|
.service(agreements::humans)
|
||||||
|
|
14
src/routes/api_v1.rs
Normal file
14
src/routes/api_v1.rs
Normal 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,
|
||||||
|
})
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
pub mod agreements;
|
pub mod agreements;
|
||||||
|
pub mod api_v1;
|
||||||
pub mod blog;
|
pub mod blog;
|
||||||
pub mod contrib;
|
pub mod contrib;
|
||||||
pub mod cours;
|
pub mod cours;
|
||||||
|
|
Loading…
Reference in a new issue