aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 5f49165e3d9610a0f3469347a0ba0ab47fee66e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use crate::frontend::style::CSS_BUNDLE;
use actix_web::{get, web, App, HttpServer, Responder};
use frontend::pages::home::page_home;

pub mod frontend;

#[get("/assets/style.css")]
async fn assets_style() -> impl Responder {
    CSS_BUNDLE
}

#[get("/{name}")]
async fn hello(name: web::Path<String>) -> impl Responder {
    format!("Hello {}!", &name)
}

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    env_logger::init_from_env("LOG");
    HttpServer::new(|| App::new().service(page_home).service(hello))
        .bind(("127.0.0.1", 8080))?
        .run()
        .await
}