actix-web/examples/web-cors/backend/src/user.rs

20 lines
434 B
Rust

use actix_web::*;
use futures::Future;
#[derive(Deserialize,Serialize, Debug)]
struct Info {
username: String,
email: String,
password: String,
confirm_password: String,
}
pub fn info(req: HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>> {
req.json()
.from_err()
.and_then(|res: Info| {
Ok(httpcodes::HTTPOk.build().json(res)?)
}).responder()
}