aboutsummaryrefslogtreecommitdiff
path: root/src/bin/actix.rs
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2022-06-11 18:15:38 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2022-06-11 18:15:38 +0200
commit6a31a30b98f7febe9ac0db74211ef074aefc7ad3 (patch)
tree9ce8694f0f37efcc5b1eb72d9e2d26731ad7ec6a /src/bin/actix.rs
parent96c2cbe1850f95806cccb6f47a7739eb9c2ac860 (diff)
downloadmacroblog.rs-6a31a30b98f7febe9ac0db74211ef074aefc7ad3.tar.gz
macroblog.rs-6a31a30b98f7febe9ac0db74211ef074aefc7ad3.tar.bz2
macroblog.rs-6a31a30b98f7febe9ac0db74211ef074aefc7ad3.zip
feat: Add project tab
Diffstat (limited to 'src/bin/actix.rs')
-rw-r--r--src/bin/actix.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/bin/actix.rs b/src/bin/actix.rs
index 101fe2e..978e8ed 100644
--- a/src/bin/actix.rs
+++ b/src/bin/actix.rs
@@ -1,5 +1,5 @@
use actix_web::{get, web, middleware, App, HttpResponse, HttpServer, Responder, http::header::ContentType};
-use macroblog::blog::{render_index_page, render_post_page};
+use macroblog::blog::{render_index_page, render_post_page, render_projects};
use macroblog::router::blog_post_exists;
use std::env;
@@ -12,6 +12,15 @@ async fn index() -> impl Responder {
.body(body)
}
+#[get("/projects")]
+async fn projects() -> impl Responder {
+ let body = render_projects();
+
+ HttpResponse::Ok()
+ .content_type(ContentType::html())
+ .body(body)
+}
+
#[get("/posts/{name}")]
async fn posts(name: web::Path<String>) -> impl Responder {
@@ -36,6 +45,7 @@ async fn main() -> std::io::Result<()> {
App::new()
.wrap(middleware::Compress::default())
.service(index)
+ .service(projects)
.service(posts)
})
.bind(("0.0.0.0", port))?