1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-25 08:52:42 +01:00
actix-web/examples/web-cors/backend/src/user.rs

20 lines
469 B
Rust
Raw Normal View History

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