1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-25 01:51:23 +02:00

cleanup more examples

This commit is contained in:
Nikolay Kim
2017-12-20 21:06:04 -08:00
parent 406d2c41e9
commit 0a68811dce
4 changed files with 42 additions and 44 deletions

View File

@ -37,15 +37,15 @@ struct State {
fn index(req: HttpRequest<State>) -> Box<Future<Item=HttpResponse, Error=Error>> {
let name = &req.match_info()["name"];
Box::new(
req.state().db.call_fut(CreateUser{name: name.to_owned()})
.from_err()
.and_then(|res| {
match res {
Ok(user) => Ok(httpcodes::HTTPOk.build().json(user)?),
Err(_) => Ok(httpcodes::HTTPInternalServerError.response())
}
}))
req.state().db.call_fut(CreateUser{name: name.to_owned()})
.from_err()
.and_then(|res| {
match res {
Ok(user) => Ok(httpcodes::HTTPOk.build().json(user)?),
Err(_) => Ok(httpcodes::HTTPInternalServerError.response())
}
})
.responder()
}
fn main() {