it worky :D
This commit is contained in:
parent
d4ae60eed9
commit
9b242a7a06
|
@ -1,5 +1,4 @@
|
||||||
use actix_web_lab::respond::Html;
|
use actix_web::{web, App, HttpServer};
|
||||||
use actix_web::{web, App, HttpServer, Result, Responder};
|
|
||||||
|
|
||||||
mod public;
|
mod public;
|
||||||
|
|
||||||
|
@ -8,7 +7,7 @@ async fn main() -> std::io::Result<()> {
|
||||||
|
|
||||||
HttpServer::new(|| {
|
HttpServer::new(|| {
|
||||||
App::new()
|
App::new()
|
||||||
.route("/", public::get().to(index))
|
.route("/", web::get().to(public::index))
|
||||||
})
|
})
|
||||||
|
|
||||||
.bind("0.0.0.0:8080")?
|
.bind("0.0.0.0:8080")?
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
use actix_web_lab::respond::Html;
|
use actix_web_lab::respond::Html;
|
||||||
use actix_web::{Result, Responder};
|
use actix_web::{Result, Responder};
|
||||||
|
use askama::Template;
|
||||||
|
|
||||||
|
|
||||||
mod templates;
|
mod templates;
|
||||||
|
|
||||||
async fn index() -> Result<impl Responder> {
|
pub async fn index() -> Result<impl Responder> {
|
||||||
let html = templates::IndexTemplate {
|
let html = templates::IndexTemplate {
|
||||||
placeholder: "hewwo world"
|
placeholder: "hewwo world"
|
||||||
}.render().expect("Failed to render index.html");
|
}.render().expect("Failed to render index.html");
|
||||||
|
|
|
@ -3,5 +3,5 @@ use askama::Template;
|
||||||
#[derive(Template)]
|
#[derive(Template)]
|
||||||
#[template(path = "index.html")]
|
#[template(path = "index.html")]
|
||||||
pub struct IndexTemplate<'a> {
|
pub struct IndexTemplate<'a> {
|
||||||
placeholder: &'a str,
|
pub placeholder: &'a str,
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user