test route
This commit is contained in:
parent
3f17609b0c
commit
2dd4995479
2 changed files with 33 additions and 0 deletions
|
@ -20,6 +20,9 @@ mod networks;
|
||||||
#[path = "routes/portfolio.rs"]
|
#[path = "routes/portfolio.rs"]
|
||||||
mod portfolio;
|
mod portfolio;
|
||||||
|
|
||||||
|
#[path = "routes/portfolio2.rs"]
|
||||||
|
mod portfolio2;
|
||||||
|
|
||||||
#[path = "routes/contrib.rs"]
|
#[path = "routes/contrib.rs"]
|
||||||
mod contrib;
|
mod contrib;
|
||||||
|
|
||||||
|
@ -50,6 +53,7 @@ async fn main() -> io::Result<()> {
|
||||||
.service(agreements::sitemap)
|
.service(agreements::sitemap)
|
||||||
.service(networks::page)
|
.service(networks::page)
|
||||||
.service(portfolio::page)
|
.service(portfolio::page)
|
||||||
|
.service(portfolio2::page)
|
||||||
.service(contrib::page)
|
.service(contrib::page)
|
||||||
.service(Files::new("/", config.static_location.clone()))
|
.service(Files::new("/", config.static_location.clone()))
|
||||||
.default_service(web::to(not_found::page))
|
.default_service(web::to(not_found::page))
|
||||||
|
|
29
src/routes/portfolio2.rs
Normal file
29
src/routes/portfolio2.rs
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
use actix_web::{get, web, HttpResponse, Responder};
|
||||||
|
use ramhorns::Content;
|
||||||
|
|
||||||
|
use crate::{config::Config, template::File};
|
||||||
|
|
||||||
|
#[get("/portfolio2")]
|
||||||
|
pub async fn page(config: web::Data<Config>) -> impl Responder {
|
||||||
|
HttpResponse::Ok().body(get_page(config.get_ref().clone()))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Content)]
|
||||||
|
struct PortfolioTemplate {
|
||||||
|
page_title: String,
|
||||||
|
bots_app: Vec<File>,
|
||||||
|
persos_app: Vec<File>,
|
||||||
|
univ_content: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_page(config: Config) -> std::string::String {
|
||||||
|
config.tmpl.render(
|
||||||
|
"portfolio2.html",
|
||||||
|
PortfolioTemplate {
|
||||||
|
page_title: "Portfolio".to_string(),
|
||||||
|
bots_app: Vec::with_capacity(0),
|
||||||
|
persos_app: Vec::with_capacity(0),
|
||||||
|
univ_content: String::new(),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
Loading…
Reference in a new issue