add networks and portfolio endpoints
This commit is contained in:
parent
2a3045e5da
commit
c4a80e15cd
4 changed files with 49 additions and 7 deletions
18
src/main.rs
18
src/main.rs
|
@ -10,14 +10,20 @@ use glob::glob;
|
||||||
use minify_html::{minify, Cfg};
|
use minify_html::{minify, Cfg};
|
||||||
mod config;
|
mod config;
|
||||||
|
|
||||||
#[path = "routes/index.rs"]
|
#[path = "routes/agreements.rs"]
|
||||||
mod index;
|
mod agreements;
|
||||||
|
|
||||||
#[path = "routes/not_found.rs"]
|
#[path = "routes/not_found.rs"]
|
||||||
mod not_found;
|
mod not_found;
|
||||||
|
|
||||||
#[path = "routes/agreements.rs"]
|
#[path = "routes/index.rs"]
|
||||||
mod agreements;
|
mod index;
|
||||||
|
|
||||||
|
#[path = "routes/networks.rs"]
|
||||||
|
mod networks;
|
||||||
|
|
||||||
|
#[path = "routes/portfolio.rs"]
|
||||||
|
mod portfolio;
|
||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> io::Result<()> {
|
async fn main() -> io::Result<()> {
|
||||||
|
@ -76,11 +82,13 @@ async fn main() -> io::Result<()> {
|
||||||
App::new()
|
App::new()
|
||||||
.app_data(web::Data::new(config.clone()))
|
.app_data(web::Data::new(config.clone()))
|
||||||
.service(index::page)
|
.service(index::page)
|
||||||
.service(Files::new("/", &folder))
|
|
||||||
.service(agreements::security)
|
.service(agreements::security)
|
||||||
.service(agreements::humans)
|
.service(agreements::humans)
|
||||||
.service(agreements::robots)
|
.service(agreements::robots)
|
||||||
.service(agreements::sitemap)
|
.service(agreements::sitemap)
|
||||||
|
.service(networks::page)
|
||||||
|
.service(portfolio::page)
|
||||||
|
.service(Files::new("/", &folder))
|
||||||
.default_service(web::to(not_found::page))
|
.default_service(web::to(not_found::page))
|
||||||
})
|
})
|
||||||
.bind(addr)?
|
.bind(addr)?
|
||||||
|
|
17
src/routes/networks.rs
Normal file
17
src/routes/networks.rs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
use actix_web::{get, HttpResponse, Responder};
|
||||||
|
use askama::Template;
|
||||||
|
|
||||||
|
#[get("/networks")]
|
||||||
|
pub async fn page() -> impl Responder {
|
||||||
|
HttpResponse::Ok().body(get_page())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(path = "../templates/networks.html")]
|
||||||
|
struct NetworksTemplate {}
|
||||||
|
|
||||||
|
pub fn get_page() -> std::string::String {
|
||||||
|
let index = NetworksTemplate {};
|
||||||
|
|
||||||
|
index.render().unwrap()
|
||||||
|
}
|
17
src/routes/portfolio.rs
Normal file
17
src/routes/portfolio.rs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
use actix_web::{get, HttpResponse, Responder};
|
||||||
|
use askama::Template;
|
||||||
|
|
||||||
|
#[get("/portfolio")]
|
||||||
|
pub async fn page() -> impl Responder {
|
||||||
|
HttpResponse::Ok().body(get_page())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(path = "../templates/portfolio.html")]
|
||||||
|
struct PortfolioTemplate {}
|
||||||
|
|
||||||
|
pub fn get_page() -> std::string::String {
|
||||||
|
let index = PortfolioTemplate {};
|
||||||
|
|
||||||
|
index.render().unwrap()
|
||||||
|
}
|
|
@ -60,7 +60,7 @@
|
||||||
<button
|
<button
|
||||||
class="buttonIndex"
|
class="buttonIndex"
|
||||||
id="buttonIndexBL"
|
id="buttonIndexBL"
|
||||||
onclick="window.location.href='networks.html';"
|
onclick="window.location.href='/networks';"
|
||||||
>
|
>
|
||||||
<span class="buttonIndex">Réseaux</span>
|
<span class="buttonIndex">Réseaux</span>
|
||||||
</button>
|
</button>
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
<button
|
<button
|
||||||
class="buttonIndex"
|
class="buttonIndex"
|
||||||
id="buttonIndexBR"
|
id="buttonIndexBR"
|
||||||
onclick="window.location.href='portfolio.html';"
|
onclick="window.location.href='/portfolio';"
|
||||||
>
|
>
|
||||||
<span class="buttonIndex">Projets</span>
|
<span class="buttonIndex">Projets</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
Loading…
Reference in a new issue