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| {
|
2018-03-30 23:07:33 -07:00
|
|
|
Ok(HttpResponse::Ok().json(res))
|
2018-01-26 19:51:13 -08:00
|
|
|
}).responder()
|
2018-01-27 11:00:26 +08:00
|
|
|
}
|