This commit is contained in:
parent
d2b520d9b6
commit
e5b5020d58
3 changed files with 21 additions and 1 deletions
|
@ -2,7 +2,7 @@ use actix_files::Files;
|
|||
use actix_web::{middleware::DefaultHeaders, web, App, HttpServer};
|
||||
use std::io::Result;
|
||||
|
||||
use crate::routes::{agreements, blog, contrib, index, networks, not_found, portfolio};
|
||||
use crate::routes::{agreements, blog, contrib, index, networks, not_found, portfolio, web3};
|
||||
|
||||
mod config;
|
||||
mod template;
|
||||
|
@ -40,6 +40,7 @@ async fn main() -> Result<()> {
|
|||
.service(contrib::page)
|
||||
.service(blog::index)
|
||||
.service(blog::page)
|
||||
.service(web3::page)
|
||||
.service(Files::new("/", config.static_location.clone()))
|
||||
.default_service(web::to(not_found::page))
|
||||
})
|
||||
|
|
|
@ -5,3 +5,4 @@ pub mod index;
|
|||
pub mod networks;
|
||||
pub mod not_found;
|
||||
pub mod portfolio;
|
||||
pub mod web3;
|
||||
|
|
18
src/routes/web3.rs
Normal file
18
src/routes/web3.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
use actix_web::{get, web, HttpResponse, Responder};
|
||||
use cached::proc_macro::once;
|
||||
use ramhorns::Content;
|
||||
|
||||
use crate::{config::Config, template::read_md};
|
||||
|
||||
#[get("/web3")]
|
||||
pub async fn page(config: web::Data<Config>) -> impl Responder {
|
||||
HttpResponse::Ok().body(get_page(config.get_ref().clone()))
|
||||
}
|
||||
|
||||
#[derive(Content)]
|
||||
struct Web3Template {}
|
||||
|
||||
#[once(time = 60)]
|
||||
pub fn get_page(_config: Config) -> String {
|
||||
read_md("[WEB3](https://web3isgoinggreat.com/)").content
|
||||
}
|
Loading…
Reference in a new issue