aboutsummaryrefslogtreecommitdiff
path: root/src/bin/actix.rs
diff options
context:
space:
mode:
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))?