#[macro_use]
extern crate lazy_static;

use actix_web::{ web, App, HttpServer };
use actix_files as fs;

mod build_actix;

use crate::build_actix::route;


#[actix_web::main]
// return Result or io::Error
async fn main() -> std::io::Result<()> {

    HttpServer::new( 
        || {
            App::new()
            .service( fs::Files::new("/assets", "./templates/assets/").index_file("index.html"))
            .route("/", web::get().to(route::index))
            .route("/hemp", web::get().to(route::hemp))
            .route("/tekla", web::get().to(route::spider))
            .route("/rootwork", web::get().to(route::rootwork))
            .route("/kaoscube", web::get().to(route::cube))
            .route("/cyberpreneur", web::get().to(route::cyber))
            .route("/offgrid", web::get().to(route::off))
            // info windows index
            .route("/robot", web::get().to(route::robot))
            .route("/app", web::get().to(route::app))
            .route("/virtual", web::get().to(route::business))
            .route("/network", web::get().to(route::network))
            .route("/cannabinieri", web::get().to(route::cannabinieri))
            .route("/greenhome", web::get().to(route::greenhome))
            // footer
            .route("/contact", web::get().to(route::contact))
            
        })
        .bind("0.0.0.0:5000")?
        .run()
        .await
}
