ztp/src/user.rs

24 lines
632 B
Rust

use axum::{http::StatusCode, response::IntoResponse, Form};
#[derive(serde::Deserialize)]
pub(crate) struct IndexData {
username: String,
}
pub(crate) async fn index(payload: Option<Form<IndexData>>) -> impl IntoResponse {
let username = payload.map_or("World".to_string(), move |index| -> String {
String::from(&(index.username))
});
(StatusCode::OK, format!("Hello, {}!\n", &username))
}
#[derive(serde::Deserialize)]
pub(crate) struct Subscription {
_email: String,
_name: String,
}
pub(crate) async fn subscribe(_payload: Form<Subscription>) -> impl IntoResponse {
(StatusCode::OK, ())
}