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
434 B
Rust
Raw Normal View History

2018-01-27 04:00:26 +01:00
use actix_web::*;
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-01-27 04:00:26 +01:00
req.json()
2018-01-27 04:51:13 +01:00
.from_err()
.and_then(|res: Info| {
2018-01-27 04:00:26 +01:00
Ok(httpcodes::HTTPOk.build().json(res)?)
2018-01-27 04:51:13 +01:00
}).responder()
2018-01-27 04:00:26 +01:00
}