refactor: change query to form for subscription api
This commit is contained in:
parent
08561d48a2
commit
476eed4559
2 changed files with 49 additions and 38 deletions
|
|
@ -1,12 +1,23 @@
|
|||
use axum::Form;
|
||||
use axum::http::StatusCode;
|
||||
use axum::routing::post;
|
||||
use axum::Router;
|
||||
// use serde::Deserialize;
|
||||
use serde::Deserialize;
|
||||
|
||||
// #[derive(Deserialize)]
|
||||
// struct FormData {
|
||||
// email: String,
|
||||
// name: String,
|
||||
// }
|
||||
pub fn routes_subscriptions() -> Router {
|
||||
Router::new().route("/subscriptions", post(|| async {}))
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct FormData {
|
||||
email: String,
|
||||
name: String,
|
||||
}
|
||||
|
||||
async fn subscribe(Form(params): Form<FormData>) {
|
||||
// println!("Params are: {params:?}");
|
||||
// if params.name.is_empty() || params.email.is_empty() {
|
||||
// return StatusCode::NOT_ACCEPTABLE;
|
||||
// }
|
||||
// StatusCode::OK
|
||||
}
|
||||
|
||||
pub fn routes_subscriptions() -> Router {
|
||||
Router::new().route("/subscriptions", post(subscribe))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue