aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..5f49165
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,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
+}