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, 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
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,5 +3,5 @@ use askama::Template;
 | 
			
		|||
#[derive(Template)]
 | 
			
		||||
#[template(path = "index.html")]
 | 
			
		||||
pub struct IndexTemplate<'a> {
 | 
			
		||||
    placeholder: &'a str, 
 | 
			
		||||
    pub placeholder: &'a str, 
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user