it worky :D

This commit is contained in:
xomf 2024-03-23 15:42:02 -04:00
parent d4ae60eed9
commit 9b242a7a06
3 changed files with 7 additions and 6 deletions

View File

@ -1,5 +1,4 @@
use actix_web_lab::respond::Html;
use actix_web::{web, App, HttpServer, Result, Responder};
use actix_web::{web, App, HttpServer};
mod public;
@ -8,10 +7,10 @@ async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
App::new()
.route("/", public::get().to(index))
.route("/", web::get().to(public::index))
})
.bind("0.0.0.0:8080")?
.run()
.await
}
}

View File

@ -1,9 +1,11 @@
use actix_web_lab::respond::Html;
use actix_web::{Result, Responder};
use askama::Template;
mod templates;
async fn index() -> Result<impl Responder> {
pub async fn index() -> Result<impl Responder> {
let html = templates::IndexTemplate {
placeholder: "hewwo world"
}.render().expect("Failed to render index.html");

View File

@ -3,5 +3,5 @@ use askama::Template;
#[derive(Template)]
#[template(path = "index.html")]
pub struct IndexTemplate<'a> {
placeholder: &'a str,
pub placeholder: &'a str,
}