1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-01-31 19:10:07 +01:00

20 lines
469 B
Rust
Raw Normal View History

2018-03-30 23:37:15 -07:00
use actix_web::{AsyncResponder, Error, HttpMessage, HttpResponse, HttpRequest};
2018-01-26 19:51:13 -08:00
use futures::Future;
2018-01-27 11:00:26 +08:00
#[derive(Deserialize,Serialize, Debug)]
struct Info {
username: String,
email: String,
password: String,
confirm_password: String,
}
2018-01-26 19:51:13 -08:00
pub fn info(req: HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>> {
2018-03-30 18:54:38 -07:00
req.json()
2018-01-26 19:51:13 -08:00
.from_err()
.and_then(|res: Info| {
Ok(HttpResponse::Ok().json(res))
2018-01-26 19:51:13 -08:00
}).responder()
2018-01-27 11:00:26 +08:00
}