1
0
mirror of https://github.com/actix/examples synced 2024-12-12 14:13:11 +01:00
examples/cors/backend/src/user.rs

22 lines
554 B
Rust
Raw Normal View History

2020-10-20 00:36:53 +02:00
use actix_web::{post, web};
use serde::{Deserialize, Serialize};
2018-05-08 20:08:43 +02:00
#[derive(Deserialize, Serialize, Debug)]
2018-04-13 10:03:58 +02:00
pub struct Info {
username: String,
email: String,
password: String,
confirm_password: String,
}
2020-10-20 00:36:53 +02:00
#[post("/user/info")]
2019-12-16 08:09:54 +01:00
pub async fn info(info: web::Json<Info>) -> web::Json<Info> {
println!("=========={info:?}=========");
2019-03-29 21:43:03 +01:00
web::Json(Info {
2018-05-08 20:08:43 +02:00
username: info.username.clone(),
email: info.email.clone(),
password: info.password.clone(),
confirm_password: info.confirm_password.clone(),
2019-03-29 21:43:03 +01:00
})
}