diff --git a/Cargo.lock b/Cargo.lock index 0503808..c6d6a84 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1103,6 +1103,7 @@ version = "0.1.0" dependencies = [ "actix-web", "notify-rust", + "serde", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 1feb523..f88ae8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,3 +6,4 @@ edition = "2024" [dependencies] actix-web = "4.12.0" notify-rust = "4.11.7" +serde = "1.0.228" diff --git a/src/main.rs b/src/main.rs index 295e440..ef13a42 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,18 @@ -use actix_web::{App, HttpResponse, HttpServer, Responder, post}; +use actix_web::{App, HttpResponse, HttpServer, Responder, post, web}; +use serde::Deserialize; + +#[derive(Deserialize)] +struct NotificationData { + name: String, + body: String, +} #[post("/notify")] -async fn notify() -> impl Responder { - HttpResponse::InternalServerError().body("TODO: implement") +async fn notify(notification: web::Form) -> impl Responder { + HttpResponse::InternalServerError().body(format!( + "TODO: implement ({}: {})", + notification.name, notification.body + )) } #[actix_web::main]